public static void OnClanRemoved(Clan clan) { if (ClanRemoved == null) return; ClanRemoved(new ClanRemovedEventArgs() { Clan = clan }); }
public static void OnClanLeave(TSPlayer ts, Clan clan) { if (ClanLeave == null) return; ClanLeave(new ClanLeaveEventArgs() { TSplayer = ts, Clan = clan }); }
public static void OnClanLogout(TSPlayer ts, Clan clan) { if (ClanLogout == null) return; ClanLogout(new ClanLogoutEventArgs() { TSplayer = ts, Clan = clan }); }
public static void OnClanJoin(TSPlayer ts, Clan clan) { if (ClanJoin == null) return; ClanJoin(new ClanJoinEventArgs() { TSplayer = ts, Clan = clan }); }
public static void OnClanLogin(ClanMember member, Clan clan) { if (ClanLogin == null) return; ClanLogin(new ClanLoginEventArgs() { Member = member, Clan = clan }); }
public static void OnClanLeave(ClanMember member, Clan clan) { if (ClanLeave == null) return; ClanLeave(new ClanLeaveEventArgs() { Member = member, Clan = clan }); }
public ClanReturnModel Create(Clan clan) { if (clan == null) throw new ArgumentNullException(nameof(clan)); var model = Mapper.Map<ClanReturnModel>(clan); model.Url = _urlHelper.Link("GetClanById", new {id = clan.Id}); model.Category = clan.ClanCategory.GetDisplayName(); model.Kind = clan.ClanKind.GetDisplayName(); return model; }
public static void Initialize(IDatabaseAccess access) { DatabaseAccess = access; Account = new Account(); Character = new Character(); Clan = new Clan(); Convoy = new Convoy(); Item = new Item(); Realmlist = new Realmlist(); Social = new Social(); Vehicle = new Vehicle(); }
public void ReadPacket(PacketReader reader) { ClanWarStage = reader.ReadInt32(); TimeLeftSeconds = reader.ReadInt32(); Home = new Clan(); Enemy = new Clan(); Home.Read(reader); Enemy.Read(reader); Unknown1 = reader.ReadInt32(); Unknown2 = reader.ReadInt32(); WarEventCount = reader.ReadInt32(); WarEvents = new List<WarEventEntry>(); for (int i = 0; i < WarEventCount; i++) { var entry = new WarEventEntry(); entry.Unknown1 = reader.ReadInt32(); entry.Unknown2 = reader.ReadInt32(); entry.ReplayID = reader.ReadInt32(); entry.TimeLeftSeconds = reader.ReadInt32(); entry.AttackerClanID = reader.ReadInt64(); entry.AttackerID = reader.ReadInt64(); entry.DefenderClanID = reader.ReadInt64(); entry.DefenderID = reader.ReadInt64(); entry.AttackerName = reader.ReadString(); entry.DefenderName = reader.ReadString(); entry.StarsWon = reader.ReadInt32(); entry.StarsEarned = reader.ReadInt32(); entry.Damage = reader.ReadInt32(); entry.Unknown3 = reader.ReadInt32(); entry.Unknown4 = reader.ReadInt32(); entry.Unknown5 = reader.ReadInt32(); entry.Unknown6 = reader.ReadInt32(); entry.Unknown7 = reader.ReadByte(); entry.Unknown8 = reader.ReadInt32(); entry.Unknown9 = reader.ReadInt32(); entry.Unknown10 = reader.ReadInt32(); entry.Unknown11 = reader.ReadInt32(); WarEvents.Add(entry); } }
public void setClanRights(Clan.ClanRank rights) { if (rights == Clan.ClanRank.NO_RANK) { if (clan.getOwnerFriends().Contains(p.getLoginDetails().getLongName())) { rights = Clan.ClanRank.FRIEND; } } else { if(!clan.getUsersWithRank().ContainsKey(p.getLoginDetails().getUsername())) clan.getUsersWithRank().Add(p.getLoginDetails().getUsername(), rights); if (clan.getUsersWithRank().Count >= 250) { misc.WriteError("Clan 'usersWithRank' map size needs increasing!"); } } this.rights = rights; }
public async Task<IHttpActionResult> PostClan(CreateClanBindingModel createClanModel) { if (!ModelState.IsValid) return BadRequest(ModelState); var clan = new Clan { Name = createClanModel.Name, ClanCategory = createClanModel.ClanCategory, ClanKind = createClanModel.ClanKind, Description = createClanModel.Description }; var addClanResult = await TheClanStore.CreateAsync(clan); if (!addClanResult.Succeeded) return GetErrorResult(addClanResult); var locationHeader = new Uri(Url.Link("GetClanById", new {id = clan.Id})); return Created(locationHeader, TheModelFactory.Create(clan)); }
void GiveRewad() { OwnershipStakeServer stake = GetComponent <OwnershipStakeServer>(); if (stake.AuthorizedClans == null || stake.AuthorizedClans.Count() == 0) { return; } Clan clan = gameObject.GetComponent <OwnershipStakeServer>().AuthorizedClans.FirstOrDefault(); time++; if (controlClan != clan.ClanGuid) { controlClan = clan.ClanGuid; time = 0; } if (time >= 60) { time = 0; Interface.CallHook("OnClanReward", clan); } }
public void EditClanBannar() { InformationManager.DisplayMessage(new InformationMessage("测试修改封臣")); Kingdom kingdom = Hero.MainHero.MapFaction as Kingdom; if (kingdom.Clans.Count > 1) { Clan clan = kingdom.Clans.Where(obj => obj != Clan.PlayerClan).First(); if (null != clan) { OpenBannerSelectionScreen(clan, clan.Leader); //this.editClanBanner(); } else { InformationManager.DisplayMessage(new InformationMessage("没有封臣")); } } else { InformationManager.DisplayMessage(new InformationMessage("没有封臣")); } }
public override void RunImplement() { try { Account player = client.SessionPlayer; if (player == null) { return; } Clan clan = ClanManager.GetClan(player.clanId); if (ClanManager.CheckNameLengthInvalid(clanName) || !StringFilter.CheckStringFilter(clanName) || ClanManager.IsClanNameExist(clanName).Result) { client.SendCompletePacket(PackageDataManager.CLAN_CHECK_NAME_ERROR_ACK); } else { client.SendCompletePacket(PackageDataManager.CLAN_CHECK_NAME_SUCCESS_ACK); } } catch (Exception ex) { PacketLog(ex); } }
public static void dealKindomLeader(Clan clan, Hero hero) { if (null != clan.Kingdom && clan.Kingdom.Leader == hero) { //InformationManager.DisplayMessage(new InformationMessage("clan.Kingdom.Leader Change")); List <Clan> oteherClans = clan.Kingdom.Clans.Where((obj) => obj != clan && !obj.IsEliminated).ToList(); if (oteherClans.Count > 0) { IEnumerable <Clan> sortedStudents = from item in oteherClans orderby item.Renown descending select item; Clan targetClan = sortedStudents.First(); clan.Kingdom.RulingClan = targetClan; TextObject textObject = GameTexts.FindText("sue_more_spouses_kindom_leader_change", null); StringHelpers.SetCharacterProperties("SUE_HERO", targetClan.Leader.CharacterObject, null, textObject); InformationManager.AddQuickInformation(textObject, 0, null, "event:/ui/notification/quest_finished"); } else { //InformationManager.DisplayMessage(new InformationMessage("clan.Kingdom destory")); DestroyKingdomAction.Apply(clan.Kingdom); } } }
public override void run() { try { Account pl = _client._player; if (pl == null) { return; } Clan clan = ClanManager.getClan(pl.clanId); if (clan._id == 0) { _client.SendPacket(new CLAN_MEMBER_LIST_PAK(-1)); return; } List <Account> clanPlayers = ClanManager.getClanPlayers(pl.clanId, -1, false); using (SendGPacket p = new SendGPacket()) { int count = 0; for (int i = (page * 14); i < clanPlayers.Count; i++) { WriteData(clanPlayers[i], p); if (++count == 14) { break; } } _client.SendPacket(new CLAN_MEMBER_LIST_PAK(page, count, p.mstream.ToArray())); } } catch (Exception ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[CLAN_MEMBER_LIST_REC.run] Erro fatal!"); } }
private static void ApplyInternal(Clan usurpingClan) { if (Settings.Instance.EnableStorylineProtection && StoryMode.StoryMode.Current.MainStoryLine.MainStoryLineSide == MainStoryLineSide.None) { if (StoryModeData.IsKingdomImperial(usurpingClan.Kingdom)) { StoryMode.StoryMode.Current.MainStoryLine.SetStoryLineSide(MainStoryLineSide.SupportImperialKingdom); } else { StoryMode.StoryMode.Current.MainStoryLine.SetStoryLineSide(MainStoryLineSide.SupportAntiImperialKingdom); } } List <Clan> supportingClans, opposingClans; GetClanSupport(usurpingClan, out supportingClans, out opposingClans); usurpingClan.Influence -= usurpingClan.Kingdom.RulingClan.Influence; usurpingClan.Kingdom.RulingClan.Influence = 0; usurpingClan.Kingdom.RulingClan = usurpingClan; AdjustRelations(usurpingClan, supportingClans, 10); AdjustRelations(usurpingClan, opposingClans, 20); }
protected Character(int id, string name, Hangar hangar, Faction factionId, Vector position, Spacemap spacemap, Reward rewards, Clan clan = null) : base(id) { Name = name; Hangar = hangar; FactionId = factionId; Position = position; Spacemap = spacemap; Reward = rewards; Clan = clan; //Default initialization Moving = false; OldPosition = new Vector(0, 0); Destination = position; Direction = new Vector(0, 0); MovementStartTime = new DateTime(); MovementTime = 0; RenderRange = 2000; Range = new Range { Character = this }; Skills = new Skilltree(this); Updaters = new Updaters(this); Cooldowns = new CooldownsAssembly(this); LastCombatTime = DateTime.Now; if (clan == null) { Clan = Global.StorageManager.Clans[0]; } Ticked += AssembleTick; }
public async Task WithClanId_ShouldBeHttpStatusCodeOk() { // Arrange var userId = new UserId(); var clan = new Clan("ClanName", new UserId()); var candidature = new Candidature(userId, clan.Id); var factory = TestHost.WithClaimsFromDefaultAuthentication(new Claim(JwtClaimTypes.Subject, userId.ToString())); _httpClient = factory.CreateClient(); var testServer = factory.Server; testServer.CleanupDbContext(); await testServer.UsingScopeAsync( async scope => { var clanRepository = scope.GetRequiredService <IClanRepository>(); clanRepository.Create(clan); await clanRepository.UnitOfWork.CommitAsync(); var candidatureRepository = scope.GetRequiredService <ICandidatureRepository>(); candidatureRepository.Create(candidature); await candidatureRepository.UnitOfWork.CommitAsync(); }); // Act using var response = await this.ExecuteAsync(clan.Id); // Assert response.EnsureSuccessStatusCode(); response.StatusCode.Should().Be(HttpStatusCode.OK); var challengeResponses = await response.Content.ReadAsJsonAsync <CandidatureDto[]>(); challengeResponses.Should().HaveCount(1); }
public async Task FetchMembersAsync_ShouldBeOfTypeMemberList() { // Arrange var ownerId = new UserId(); var clan = new Clan("test", ownerId); TestMock.ClanRepository.Setup(repository => repository.FetchMembersAsync(It.IsAny <ClanId>())) .ReturnsAsync( new List <Member> { new Member(clan.Id, ownerId) }) .Verifiable(); var service = new ClanService(TestMock.ClanRepository.Object); // Act var result = await service.FetchMembersAsync(clan); // Assert result.Should().BeOfType <List <Member> >(); TestMock.ClanRepository.Verify(repository => repository.FetchMembersAsync(It.IsAny <ClanId>()), Times.Once); }
protected override bool Izvrsi(IOpstiDomenskiObjekat odo) { try { Clan c = odo as Clan; //c.ClanskiBroj = GenerickiBroker.Instanca.DajClanskiBroj(); c.ClanskiBroj = GenerickiBroker.Instanca.SelectMax(c); int rez = GenerickiBroker.Instanca.Insert(c); if (rez > 0) { return(true); } else { return(false); } } catch (Exception e) { return(false); } }
private void ButtonUbaci_Click(object sender, RoutedEventArgs e) { WindowClanPromena w1 = new WindowClanPromena(); w1.Title = "Ubaci podatke o clanu"; w1.Owner = this; if (w1.ShowDialog() == true) { Clan c = w1.Clan; int id = cDal.UbaciClana(c); if (id != -1) { PrikaziClanove(); ListBox1.SelectedIndex = listaClanova.FindIndex(c1 => c1.ClanId == id); MessageBox.Show("Ubacen novi clan"); } else { MessageBox.Show("Greska pri unosu clana"); } } }
private void Dugme_Obrisi_Click(object sender, RoutedEventArgs e) { if (TestPolja()) { // MessageBox.Show("Polja su pravilno popunjena", "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Information); Clan clan = new Clan(int.Parse(idClanTextBox.Text), imeTextBox.Text, prezimeTextBox.Text, emailTextBox.Text, brojTelefonaTextBox.Text, jmbgTextBox.Text, (bool)studentJeClanCheckBox.IsChecked, brojIndeksaTextBox.Text, fakultetComoBox.Text, godinaUpisaDatePicker.Text, datumUclanjivanjaDatePicker.Text); SqlDataAccess sql = new SqlDataAccess(); if (sql.CuvanjeIzmeneClan(int.Parse(idClanTextBox.Text), clan)) { MessageBox.Show("Član je uspešno izmenjen", "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Information); Close(); } else { MessageBox.Show("Izmena nije uspela", "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("Polja nisu pravilno popunjena", "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Error); } }
internal static Clan GetEntity(int HighId, int LowId) { LogicLong EntityId = new LogicLong(HighId, LowId); if (EntityId.IsZero == false) { Clan Clan = null; if (Clan != null) { return(Clan); } else { Console.WriteLine("[*] Invalid arguments, the specified clan doesn't exist."); } } else { Console.WriteLine("[*] Missing arguments, please select a clan first."); } return(null); }
public ClanCreate(Client User, XmlDocument Packet) : base(User, Packet) { using (MySqlConnection result = SQL.GetConnection().GetAwaiter().GetResult()) { using (MySqlDataReader mySqlDataReader = new MySqlCommand("SELECT * FROM clans WHERE Name='" + this.Query.Attributes["clan_name"].InnerText + "'", result).ExecuteReader()) { if (mySqlDataReader.HasRows) { mySqlDataReader.Close(); throw new StanzaException(User, Packet, 4); } mySqlDataReader.Close(); } this.Clan = new Clan(this.Query.Attributes["clan_name"].InnerText, Encoding.UTF8.GetString(Convert.FromBase64String(this.Query.Attributes["description"].InnerText)), User); this.Process(); if (User.Player.RoomPlayer.Room != null) { User.Player.RoomPlayer.Room.Sync((Client)null); } Console.WriteLine(User.Player.Nickname + "clan created with name:" + this.Query.Attributes["clan_name"].InnerText); result.Close(); } }
private void handleClickNine(Player player, Packet packet) { int interfaceId = packet.readUShort(); int child = packet.readUShort(); int slot = packet.readUShort(); Console.WriteLine("InterfaceOption 9: interfaceId: " + interfaceId); switch(interfaceId) { case 590: // Clan chat setup Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername()); if (clan == null) { player.getPackets().sendMessage("Please create your clan chat before changing settings."); break; } switch(child) { case 23: // "Who can enter chat" - only me/owner. clan.setEnterRights(Clan.ClanRank.OWNER); player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23); break; case 24: // "Who can talk in chat" - only me/owner. clan.setTalkRights(Clan.ClanRank.OWNER); player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24); break; case 25: // // "Who can kick in chat" - only me/owner. clan.setKickRights(Clan.ClanRank.OWNER); player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25); break; case 26: // "Who can share loot" - only me/owner. clan.setLootRights(Clan.ClanRank.OWNER); player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26); break; } break; } }
private static void ConsiderFiefGiveAway(Clan clan) { if (clan == Clan.PlayerClan || clan.Kingdom == null || clan.Kingdom.RulingClan != clan) { return; } if (clan.Settlements == null || clan.Settlements.Count(s => s.IsFortification) < 2) { return; } Kingdom kingdom = clan.Kingdom; if (kingdom.UnresolvedDecisions.FirstOrDefault((KingdomDecision x) => x is SettlementClaimantDecision) != null) { return; } Clan bomzh = kingdom.Clans.FirstOrDefault(c => !c.IsUnderMercenaryService && c.Heroes.Count(h => h.IsAlive) > 0 && (c.Settlements == null || c.Settlements.Count() == 0)); if (bomzh == null) { return; } SettlementValueModel model = Campaign.Current.Models.SettlementValueModel; Settlement settlement = clan.Settlements .Where(s => s.IsFortification) .MaxBy(s => model.CalculateValueForFaction(s, kingdom)); ChangeOwnerOfSettlementAction.ApplyByKingDecision(bomzh.Leader, settlement); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Clan clan = db.Clan.Find(id); if (clan == null) { return(HttpNotFound()); } ClanViewModel ClanViewModel = new ClanViewModel(); ClanViewModel.ClanID = clan.ClanID; ClanViewModel.Name = clan.Name; ClanViewModel.SymbolPic = clan.SymbolPic; ClanViewModel.IsEvil = clan.IsEvil; ClanViewModel.MessageToClient = "ViewModel from client"; return(View(ClanViewModel)); }
public static void Dodaj() { Console.WriteLine("Upisite ID nove pozajmice"); int id = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Upisite ID pozajmljene knjige: "); int knjigaId = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Upisite ID clana pozajmioca za knjigu (ID:" + knjigaId + "):"); int clanId = Convert.ToInt32(Console.ReadLine()); Clan clan = ClanDAO.GetClanById(Program.conn, clanId); Knjiga knjiga = KnjigaDAO.GetKnjigaById(Program.conn, knjigaId); if (GetBrojKnjigaZaClana(clan) >= 4) { Console.WriteLine("Taj clan vec ima maksimalan dozvoljen broj pozajmljenih knjiga (4)."); return; } ClanKnjige ck = new ClanKnjige(id, clan, knjiga); ClanKnjigeDAO.Add(Program.conn, ck); }
public static void LeaderAcceptsOffer_notifySourceTribe(Tribe sourceTribe, Tribe targetTribe, long eventId) { World world = sourceTribe.World; Clan sourceDominantClan = sourceTribe.DominantFaction as Clan; if (sourceTribe.IsUnderPlayerFocus || sourceDominantClan.IsUnderPlayerGuidance) { Decision decision = new AcceptedFosterTribeRelationDecision(sourceTribe, targetTribe, eventId); // Notify player that tribe leader acepted offer if (sourceDominantClan.IsUnderPlayerGuidance) { world.AddDecisionToResolve(decision); } else { decision.ExecutePreferredOption(); } } else { AcceptedFosterTribeRelationDecision.TargetTribeAcceptedOffer(sourceTribe, targetTribe); } }
public static MvcHtmlString PrintClan(this HtmlHelper helper, Clan clan, bool colorize = true) { var url = Global.UrlHelper(); if (clan == null) { return(new MvcHtmlString(string.Format("<a href='{0}'>No Clan</a>", url.Action("Index", "Clans")))); } { string color = Clan.ClanColor(clan, Global.ClanID); if (String.IsNullOrEmpty(color)) { color = "#B0D0C0"; } return (new MvcHtmlString( string.Format("<a href='{0}' nicetitle='$clan${4}'><img src='{1}' width='16'><span style='color:{2}'>{3}</span></a>", url.Action("Detail", "Clans", new { id = clan.ClanID }), clan.GetImageUrl(), colorize ? color : "", HttpUtility.HtmlEncode(clan.Shortcut), clan.ClanID))); } }
public static void CalculateInfluenceChangePatch(ref float __result, Clan clan, StatExplainer explanation = null) { if (Settings.Instance.EnableInfluenceBalancing) { float influenceChange = __result; if (Settings.Instance.EnableCorruption) { float corruption = clan.GetCorruption(); if (corruption > 0) { explanation?.AddLine(new TextObject("{=dUCOV7km}Corruption (too many fiefs)").ToString(), -corruption); influenceChange -= corruption; } } if (Settings.Instance.EnableInfluenceDecay) { int influenceDecayFactor = clan.Influence > Settings.Instance.InfluenceDecayThreshold ? (int)-((clan.Influence - Settings.Instance.InfluenceDecayThreshold) * (Settings.Instance.InfluenceDecayPercentage / 100)) : 0; if (influenceDecayFactor < 0) { explanation?.AddLine(new TextObject("{=koTNaZUX}Influence Decay (too much influence)").ToString(), influenceDecayFactor); influenceChange += influenceDecayFactor; } } float maximumInfluenceLoss = Settings.Instance.MaximumInfluenceLoss; if (influenceChange < -maximumInfluenceLoss) { explanation?.AddLine(new TextObject("{=uZc8Hg01}Maximum Influence Loss").ToString(), -maximumInfluenceLoss, StatExplainer.OperationType.LimitMin); influenceChange = -maximumInfluenceLoss; } __result = influenceChange; } }
/// <summary> /// Initializes a new instance of the <see cref="ClanCompleteMessageComponent"/> class from /// the specified <see cref="Clan"/>. /// </summary> /// <param name="clan"><see cref="Clan"/> from which the data will be set.</param> /// <exception cref="ArgumentNullException"><paramref name="clan"/> is null.</exception> public ClanCompleteMessageComponent(Clan clan) { if (clan == null) { throw new ArgumentNullException(nameof(clan)); } Id = clan.Id; Name = clan.Name; Badge = clan.Badge; InviteType = clan.InviteType; MemberCount = clan.Members.Count; TotalTrophies = clan.TotalTrophies; RequiredTrophies = clan.RequiredTrophies; WarsWon = clan.WarsWon; WarsLost = clan.WarsLost; WarsTried = clan.WarsTried; Language = clan.Language; WarFrequency = clan.WarFrequency; Location = clan.Location; PerkPoints = clan.PerkPoints; Level = clan.ExpLevels; WinStreak = clan.WinStreak; }
private void InsertClan(Clan clan) { MySqlConnection con = null; MySqlCommand cmd; try { con = MySql.MySqlUtil.GetConnection(); cmd = con.CreateCommand(); cmd.CommandText = INSERT; cmd.Parameters.AddWithValue("@IdClan", clan.IdClan); cmd.Parameters.AddWithValue("DatumUclanjivanja", clan.DatumUclanjivanja); cmd.Parameters.AddWithValue("@DatumObnavljanjaClanstva", clan.DatumObnavljanjaClanstva); cmd.ExecuteNonQuery(); } catch (Exception exc) { throw new DataAccessException("Exception in MySqlClan", exc); } finally { MySqlUtil.CloseQuietly(con); } }
private void end_with_reflection(Collision collision, ColoredBody body_hit) { var bullet_velocity = movable.Velocity; var body_velocity = body_hit.Movable.Velocity; if (!is_reflected) { // To avoid multiple reflective collisions is_reflected = true; play_impact_animation(); // TODO: replace by another impact? // Now for the rest of the lifetime, we just go in another direction\ var body_influence_ratio = 2f; // The body movement influences to the reflected direction var impact_direction = (bullet_velocity - body_velocity * body_influence_ratio).normalized; transform.forward = Vector3.Reflect(impact_direction, collision.contacts[0].normal); // As soon as the bullet is reflected, it can hit anybody matching it! clan_who_fired = body_hit.clan; } // Push the bullet againt the shield var min_bullet_push = 1f; // Minimum distance the bullet will be pushed (to be safer from glitches) transform.Translate(transform.forward * Mathf.Max(min_bullet_push, -collision.contacts[0].separation + body_hit.Movable.LastMove.magnitude + movable.LastMove.magnitude), Space.World); }
private void handleClanKick(Player player, Packet packet) { long name = packet.readLong(); if (name < 0) { return; } Clan clan = Server.getClanManager().getClanByPlayer(player); if (clan != null) { ClanUser user = clan.getUserByName(player.getLoginDetails().getUsername()); if (user != null) { if (user.getClanRights() < clan.getKickRights()) { player.getPackets().sendMessage("You do not have a high enough rank to kick users from this clan chat."); return; } clan.kickUser(name); } } }
public static void getClans() { try { List <Clan> list = new List <Clan>(); using (var reader = MySqlHelper.ExecuteReader(Connector.ConnectionString, "SELECT * FROM `clans`")) { while (reader.Read()) { Clan clan = new Clan() { Id = reader.GetUInt64("ClanID"), OwnerId = reader.GetUInt64("OwnerID"), Name = reader.GetString("Name"), Rank = reader.GetInt16("Rank"), Exp = reader.GetInt32("Exp"), Logo1 = reader.GetInt16("Logo1"), Logo2 = reader.GetInt16("Logo2"), Logo3 = reader.GetInt16("Logo3"), Logo4 = reader.GetInt16("Logo4"), Color = reader.GetInt16("Color"), MaxPlayersCount = reader.GetInt32("MaxPlayersCount"), PlayersCount = reader.GetInt32("PlayersCount"), Info = reader.GetString("Info"), Notice = reader.GetString("Notice"), }; list.Add(clan); } } Logger.Info("[ClansTable] Loaded {0} clan lists", list.Count); } catch (Exception ex) { Logger.Error("[Error] {0}", ex); } }
// Used whenever the clients searches for an alliance however no alliances is loaded in memory. public static List <Clan> GetAllAlliances() { var alliances = new List <Clan>(); try { using (var ctx = new MysqlEntities()) { var clans = ctx.clan; Parallel.ForEach(clans, c => { Clan clan = default(Clan); clan = JsonConvert.DeserializeObject <Clan>(c.Data, Settings2); alliances.Add(clan); }); } } catch (Exception ex) { ExceptionLogger.Log(ex, "Exception while trying to get all alliances from database."); } return(alliances); }
private bool ClanIsOfTownCulture(Town town, Clan clan) { if (clan.Culture.IsMainCulture) { return(town.Culture == clan.Culture); } else { // More complicated way to apply unique culture clans if (clan.Culture.GetCultureCode() == CultureCode.Darshi && town.Culture.GetCultureCode() == CultureCode.Aserai) { return(true); } else if (clan.Culture.GetCultureCode() == CultureCode.Nord && town.Culture.GetCultureCode() == CultureCode.Sturgia) { return(true); } else if (clan.Culture.GetCultureCode() == CultureCode.Vakken && town.Culture.GetCultureCode() == CultureCode.Sturgia) { return(true); } return(false); } }
public override void RunImplement() { try { Account player = client.SessionPlayer; if (player == null) { return; } Clan clan = ClanManager.GetClan(player.clanId); if (player.clanId == 0 || clan.id == 0 || clan.logo == logo || ClanManager.IsClanLogoExist(logo).Result) { client.SendCompletePacket(PackageDataManager.CLAN_CHECK_LOGO_ERROR_ACK); } else { client.SendCompletePacket(PackageDataManager.CLAN_CHECK_LOGO_SUCCESS_ACK); } } catch (Exception ex) { PacketLog(ex); } }
private void ButtonPromijeni_Click(object sender, RoutedEventArgs e) { if (ListBox1.SelectedIndex < 0) { MessageBox.Show("Odaberite clana"); return; } Clan clanZaPromjenu = ListBox1.SelectedItem as Clan; WindowClanPromjena w1 = new WindowClanPromjena(); w1.Title = "Promijeni podatke o clanu"; w1.Owner = this; int id = clanZaPromjenu.ClanId; w1.Clan = clanZaPromjenu; if (w1.ShowDialog() == true) { clanZaPromjenu = w1.Clan; clanZaPromjenu.ClanId = id; int rezultat = cDal.PromeniClana(clanZaPromjenu); if (rezultat == 0) { PrikaziClanove(); ListBox1.SelectedIndex = listaClanova .FindIndex(c => c.ClanId == id); MessageBox.Show("Podaci promjenjeni"); } else { MessageBox.Show("Greska pri promjeni"); } } }
public ClanReturnModelLite CreateLite(Clan clan) { if (clan == null) throw new ArgumentNullException(nameof(clan)); var model = Mapper.Map<ClanReturnModelLite>(clan); model.Url = _urlHelper.Link("GetClanById", new {id = clan.Id}); return model; }
public Dood(int id, Clan clan) { this.id = id; this.clan = clan; equipLevel = (id%10)+11; personality = (id%5)%4; // 0 is normal, 1 is stoic, 2 is aggro, 3 is cutesy gender = (id%3)%2; // 0 is male, 1 is female role = UnitBuilder.roles[id%UnitBuilder.roles.Count]; name = UnitBuilder.names[id%UnitBuilder.names.Length]; happy = (id%17)/17f; smart = (id%19)/19f; brave = (id%23)/23f; RelationsTracker.activeDoods.Add (this); //outputDebug(); }
public void swapClans(Clan newClan) { // Update both clan rosters // TODO: Friendships should be updated based on this move... clan.rosterRemove(this); newClan.rosterAdd(this); // Do a notification. //Debug.Log (name+"("+role+") has left "+clan.name+" for "+newClan.name+"."); // Update clan reference and be happy about it! clan = newClan; happy += 0.3f; if(happy > 1f) happy = 1f; }
public static void createNewClan(Dood[] doods) { Clan newClan = new Clan(clans[popClan()], false); //Debug.Log("New Clan: "+newClan.name+" has been founded!"); foreach (Dood dood in doods){ dood.swapClans (newClan); dood.modifyHappy (0.2f); // Even better than joining an existing clan! } newClan.recalcStats(); RelationsTracker.activeClans.Add(newClan); }
// Strips the tag from a player's name private string StripTag(string name, Clan clan) { if (clan == null) return name; var re = new Regex(@"^\[" + clan.tag + @"\]\s"); while (re.IsMatch(name)) name = name.Substring(clan.tag.Length + 3); return name; }
/// <summary> /// /// </summary> /// <param name="friendList"></param> internal static void AddClanList( Clan clan ) { Monitor.Enter( s_LockClanList ); { s_ClanList.Add( clan ); } Monitor.Exit( s_LockClanList ); }
public void setClan(Clan clan) { this.clan = clan; }
// Use this for initialization void Start() { GameObject clan = GameObject.Find ("Clan"); theClan = clan.GetComponent<Clan>(); GameObject cam = GameObject.Find ("MainCamera"); ourCam = cam.GetComponent<Camera>(); GameObject listener = GameObject.Find ("ClanGUI"); Listener = listener.GetComponent<GUIListener>(); GameObject guicam = GameObject.Find ("GuiCamera"); guiCam = guicam.GetComponent<Camera>(); GameObject target = GameObject.Find("FirstSprite"); spriteToMove = target.GetComponent<faceMover>(); Listener.guiCam = guiCam; placeList = new Place[transform.childCount]; int i = 0; foreach (Transform child in transform) { placeList[i] = child.GetComponent<Place>(); Debug.Log(i +": "+ placeList[i].placeName); i++; } currentPlace = placeList [0]; targetPlace = placeList [0]; Debug.Log ("Current Place: " + currentPlace.placeName); }
// Use this for initialization void Start() { turnOrder.gameState = TurnOrder.MacroState.Placement; GameObject stackage = GameObject.Find("Stats"); turnOrder.turnOrderGui.iconPackage = stackage.GetComponent<StatTextures>(); float scalar = Mathf.Max (height / 6f, width/12f); sq.transform.localScale = new Vector3(1/scalar, 1/scalar, 1); float sqWidth = sq.icon.textureRect.width; sqExtents = sq.icon.bounds.extents; sqExtents.x = sqExtents.x * sq.transform.localScale.x; sqExtents.y = sqExtents.y * sq.transform.localScale.y; Debug.Log("Sq Width: "+sqWidth); Debug.Log("Sq Extents: "+sqExtents); lowerLeft = new Vector3(0- (width-1) * sqExtents.x, 0-(height-1) * sqExtents.y, 0); board = new SquareIcon[height, width]; for(int column = 0; column < width; column++){ for (int row = 0; row < height; row++){ board[row, column] = Instantiate(sq, new Vector3(lowerLeft.x + column*sqExtents.x*2, lowerLeft.y + row*sqExtents.y*2, 0), Quaternion.identity) as SquareIcon; board[row,column].row = row; board[row,column].col = column; } } GameObject clanObj = GameObject.Find ("Clan"); theClan = clanObj.GetComponent<Clan>(); Debug.Log ("Found clan with members: " + theClan.clanMembers.Count); GameObject clanGuiObj = GameObject.Find ("ClanGUI"); clanGui = clanGuiObj.GetComponent<GUIListener>(); clanGui.guiCam = myCam; CombatCharacter blankGob = (CombatCharacter) library.getAssetByName("goblin"); List<CombatCharacter> creeps = new List<CombatCharacter>(); int numGobs = 3; for(int i = 0; i < numGobs; i++) creeps.Add (blankGob); CombatCharacter blankHero = (CombatCharacter) library.getAssetByName("blankcharacter"); List<CombatCharacter> heroes = new List<CombatCharacter>(); foreach (Character hero in theClan.clanMembers){ heroes.Add (blankHero); } PopulateFighters(creeps, heroes); toBePlaced = new Queue<CombatCharacter>(turnOrder.fighters); }
/// <summary> /// /// </summary> /// <param name="friendList"></param> internal static void RemoveClanList( Clan clan ) { Monitor.Enter( s_LockClanList ); { s_ClanList.Remove( clan ); } Monitor.Exit( s_LockClanList ); }
public static Dood getDoodByRole(int role, Clan clan = null) { int id, i=openIDs.Count-1; do{ id = openIDs[i--]; } while(id%roles.Count != role); openIDs.RemoveAt(i+1); return new Dood(id, clan); }
public static Dood getDoodByRandom(Clan clan = null) { return new Dood(popID (), clan); }
protected void UpdateEntity(ref Clan clan, UpdateClanBindingModel updateClanModel) { if (updateClanModel.Name != null) clan.Name = updateClanModel.Name; if (updateClanModel.Description != null) clan.Description = updateClanModel.Description; if (updateClanModel.ClanCategory.HasValue) clan.ClanCategory = updateClanModel.ClanCategory.Value; if (updateClanModel.ClanKind.HasValue) clan.ClanKind = updateClanModel.ClanKind.Value; }
/// <summary> /// 读取部落列表 /// </summary> private static void LoadClanList() { bool l_bIsReturn = false; Session l_Session = new Session( BaseDatabase.Domain ); l_Session.BeginTransaction(); { do { Query l_QueryListClan = new Query( l_Session, "Select ListClan instances" ); QueryResult l_ListClanResult = l_QueryListClan.Execute(); if ( l_ListClanResult == null ) { Debug.WriteLine( "Program.LoadClanList(...) - l_ListClanResult == null error!" ); l_bIsReturn = true; break; } for ( int iIndex = 0; iIndex < l_ListClanResult.Count; iIndex++ ) { ListClan l_ListClan = l_ListClanResult[iIndex] as ListClan; if ( l_ListClan == null ) { Debug.WriteLine( "Program.LoadClanList(...) - l_ListClan == null error!" ); l_bIsReturn = true; break; } Clan l_Clan = new Clan(); l_Clan.ClanGuid = l_ListClan.ClanGuid; l_Clan.ClanName = l_ListClan.ClanName; l_Clan.Logo = l_ListClan.Logo; l_Clan.Back = l_ListClan.Back; l_Clan.Grade = l_ListClan.Grade; l_Clan.CP = l_ListClan.CP; l_Clan.Slogan = l_ListClan.Slogan; l_Clan.News = l_ListClan.News; ////////////////////////////////////////////////////////////////////////// // 获取部落的成员信息 Query l_QueryCharacters = new Query( l_Session, "Select Characters instances where {ClanGuid}=@ClanGuid" ); l_QueryCharacters.Parameters.Add( "@ClanGuid", l_ListClan.ClanGuid ); QueryResult l_CharactersResult = l_QueryCharacters.Execute(); if ( l_CharactersResult == null ) { Debug.WriteLine( "Program.LoadClanList(...) - l_CharactersResult == null error!" ); l_bIsReturn = true; break; } for ( int iIndex2 = 0; iIndex2 < l_CharactersResult.Count; iIndex2++ ) { Characters l_Characters = l_CharactersResult[iIndex2] as Characters; if ( l_Characters == null ) { Debug.WriteLine( "Program.LoadClanList(...) - l_Characters == null error!" ); l_bIsReturn = true; break; } ClanMember l_ClanMember = new ClanMember(); l_ClanMember.CharacterName = l_Characters.CharacterName; l_ClanMember.ClanGuid = l_Characters.ClanGuid; l_ClanMember.ClanRank = l_Characters.ClanRank; l_Clan.AddClanMemberList( l_ClanMember ); } if ( l_bIsReturn == true) break; Program.AddClanList( l_Clan ); } } while ( false ); } l_Session.Commit(); if ( l_bIsReturn == true ) throw new Exception( "读取部落列表 错误!" ); LOGs.WriteLine( LogMessageType.MSG_INFO, "信息: 部落列表读取完成!" ); }
// Loads the data file private void LoadData() { clans.Clear(); var data = Interface.GetMod().DataFileSystem.GetDatafile("rustio_clans"); if (data["clans"] != null) { var clansData = (Dictionary<string, object>)Convert.ChangeType(data["clans"], typeof(Dictionary<string, object>)); foreach (var iclan in clansData) { string tag = iclan.Key; var clanData = iclan.Value as Dictionary<string, object>; string description = (string)clanData["description"]; string owner = (string)clanData["owner"]; List<string> moderators = new List<string>(); foreach (var imoderator in clanData["moderators"] as List<object>) { moderators.Add((string)imoderator); } List<string> members = new List<string>(); foreach (var imember in clanData["members"] as List<object>) { members.Add((string)imember); } List<string> invited = new List<string>(); foreach (var iinvited in clanData["invited"] as List<object>) { invited.Add((string)iinvited); } Clan clan; clans.Add(tag, clan = new Clan() { tag = tag, description = description, owner = owner, moderators = moderators, members = members, invited = invited }); lookup[owner] = clan; foreach (var member in members) lookup[member] = clan; } } }
public void setClan(Transform player){ myClan = player.GetComponent<Clan> (); }
public static Clan Create(string tag, string description, string ownerId) { var clan = new Clan() { tag = tag, description = description, owner = ownerId }; clan.members.Add(ownerId); return clan; }
public ClanUser(Player p, Clan clan) { this.p = p; this.clan = clan; this.rights = Clan.ClanRank.NO_RANK; }