public override void OnButtonClick(int buttonID) { switch ((Buttons)buttonID) { case Buttons.Kick: // PartySystem.RemovePartyMember(Member.Serial); break; case Buttons.GetBar: GameScene currentGameScene = SceneManager.GetScene <GameScene>(); if (currentGameScene.PartyMemberGumpStack.Contains(Member.Mobile)) { UIManager.Remove <PartyMemberGump>(Member.Mobile); } else if (Member.Mobile == World.Player) { StatusGump status = UIManager.GetByLocalSerial <StatusGump>(); status?.Dispose(); } PartyMemberGump partymemberGump = new PartyMemberGump(Member, 300, 300); UIManager.Add(partymemberGump); currentGameScene.PartyMemberGumpStack.Add(Member.Mobile); break; } }
public override void OnButtonClick(int buttonID) { switch ((Buttons)buttonID) { case Buttons.Add: PartySystem.TriggerAddPartyMember(); break; case Buttons.Leave: PartySystem.LeaveParty(); break; case Buttons.Loot: PartySystem.AllowPartyLoot = !PartySystem.AllowPartyLoot ? true : false; break; case Buttons.Message: // break; } }
private void RefreshContextForPartyMembers(ICharacter character) { if (!this.IsSharedWithPartyAndFactionMembers) { return; } var partyMembers = PartySystem.ServerGetPartyMembersReadOnly(character); if (partyMembers.Count <= 1) { // no party or single-player party return; } var currentCharacterName = character.Name; foreach (var partyMemberName in partyMembers) { if (partyMemberName == currentCharacterName) { continue; } var partyMember = Api.Server.Characters .GetPlayerCharacter(partyMemberName); if (partyMember is not null) { var context = this.GetActiveContext(partyMember, out _); context?.Refresh(); } } }
private void ServerSendMiningSoundCue(IDynamicWorldObject objectDrone, ICharacter characterOwner) { using var observers = Api.Shared.GetTempList <ICharacter>(); var eventNetworkRadius = (byte)Math.Max( 15, Math.Ceiling(this.ProtoItemMiningTool.SoundPresetWeaponDistance.max)); Server.World.GetCharactersInRadius(objectDrone.TilePosition, observers, radius: eventNetworkRadius, onlyPlayers: true); observers.Remove(characterOwner); if (observers.Count == 0) { return; } var partyId = PartySystem.ServerGetParty(characterOwner)?.Id ?? 0; this.CallClient(observers.AsList(), _ => _.ClientRemote_OnMiningSoundCue(objectDrone, partyId, objectDrone.TilePosition)); }
private void ExecuteCommandInviteToParty() { var viewModel = (ViewModelPlayerEntry)this.DataContext; var name = viewModel.Name; PartySystem.ClientInviteMember(name); }
private void Start() { AssignedSystem = GetComponent <Realm>().trnControl; //Assign random name Health = 100; }
bool rightClickFlag; // 右クリックのフラグ // Use this for initialization void Start() { // パーティーシステムを取得する partySystem = this.gameObject.GetComponent <PartySystem>(); // 最初は自分を格納しておく targetPlayer = StaticMethods.FindGameObjectWithPhotonNetworkIDAndObjectTag(PhotonNetwork.player.ID, "Player"); ray = new Ray(); hit = new RaycastHit(); }
// Use this for initialization void Start() { // パーティーシステムを取得する partySystem = this.gameObject.GetComponent<PartySystem>(); // 最初は自分を格納しておく targetPlayer = StaticMethods.FindGameObjectWithPhotonNetworkIDAndObjectTag(PhotonNetwork.player.ID, "Player"); ray = new Ray(); hit = new RaycastHit(); }
// Use this for initialization void Start() { cameraScripts = Camera.main.GetComponent <CameraScripts>(); partySystem = GameObject.Find("PartySystem").GetComponent <PartySystem>(); playerHUD = GameObject.Find("HUD").GetComponent <PlayerHUD>(); targetedAbilityIndicator = GameObject.Find("HUD").GetComponent <TargetedAbilityIndicator>(); keyboardHelp = GameObject.Find("KeyboardHelp").gameObject; keyboardHelp.SetActive(false); lichManaBar = GameObject.Find("Bar_Mana").gameObject.GetComponent <RectTransform>(); lichManaBarScaleX = lichManaBar.localScale.x; }
private Color GetColor() { if (this.currentCharacter.IsCurrentClientCharacter) { return(RayColorCurrentPlayerCharacter); } return(PartySystem.ClientIsPartyMember(this.currentCharacter.Name) || FactionSystem.ClientIsFactionMemberOrAlly(this.currentCharacter) ? RayColorFriendlyPlayerCharacter : RayColorOtherPlayerCharacter); }
// Use this for initialization void Start() { partySystem = GameObject.Find("PartySystem").GetComponent <PartySystem>(); panel = GameObject.Find("MinimapPanel"); miniMap = panel.GetComponent <MiniMap>(); minimapIcon = transform.Find("Canvas").Find("MinimapIcon").gameObject; minimapIcon.name = "Icon_" + transform.name; myRectTransform = minimapIcon.GetComponent <RectTransform>(); minimapIcon.transform.SetParent(panel.transform); myRectTransform.localScale = new Vector3(0.75f, 0.75f, 0.75f); image = minimapIcon.GetComponent <Image>(); }
public string Execute(ICharacter player, string clanTag = null) { var party = PartySystem.ServerGetParty(player); if (party is null) { return($"Player \"{player.Name}\" has no party"); } PartySystem.ServerSetClanTag(party, clanTag); return("Party clan tag set successfully"); }
// Use this for initialization void Start() { // チャット切り替えボタンのコライダーの参照を取得 buttons[0] = allChatButton.GetComponent <BoxCollider2D>(); buttons[1] = partyChatButton.GetComponent <BoxCollider2D>(); buttons[2] = ptopChatButton.GetComponent <BoxCollider2D>(); buttons[3] = logWindowButton.GetComponent <BoxCollider2D>(); // パーティーシステムを取得 partySystem = GameObject.Find("Scripts").GetComponent <PartySystem>(); // 最小化するためのスクリプトコンポーネントを取得する miniChatWindow = gameObject.GetComponent <MiniChatWindow>(); }
public override IEnumerable <ICharacter> ServerEnumerateMessageRecepients(ICharacter forPlayer) { var members = PartySystem.ServerGetPartyMembersReadOnly(this.Party); foreach (var member in members) { var character = CharactersServerService.GetPlayerCharacter(member); if (character != null) { yield return(character); } } }
private void ServerCharacterJoinedOrLeftPartyHandler(ICharacter character) { if (PartySystem.ServerGetParty(character) is null) { return; } var context = this.GetActiveContext(character, out _); context?.Refresh(); this.RefreshContextForPartyMembers(character); }
public static void ServerSetupClaim( ILogicObject objectClaim, ICharacter character, IWorldObject worldObject, double durationSeconds) { var publicState = GetPublicState(objectClaim); publicState.PlayerCharacterId = character.Id; publicState.PlayerPartyId = PartySystem.ServerGetParty(character)?.Id ?? 0; publicState.ExpirationTime = Server.Game.FrameTime + durationSeconds; publicState.WorldObject = worldObject; }
private void ServerPartyClanTagChanged(ILogicObject party) { var serverCharacters = Server.Characters; foreach (var playerCharacterName in PartySystem.ServerGetPartyMembersReadOnly(party)) { var playerCharacter = serverCharacters.GetPlayerCharacter(playerCharacterName); if (playerCharacter != null) { this.ServerForceRefreshPlayerEntry(playerCharacter); } } }
public override bool SharedCanInteract(ICharacter character, IStaticWorldObject worldObject, bool writeToLog) { if (!base.SharedCanInteract(character, worldObject, writeToLog)) { return(false); } var ownerName = GetPublicState(worldObject).OwnerName; if (ownerName == character.Name) { return(true); } if (PveSystem.SharedIsPve(false)) { if (IsClient && PartySystem.ClientIsPartyMember(ownerName) || (IsServer && PartySystem.ServerIsSameParty(Server.Characters.GetPlayerCharacter(ownerName), character))) { // in PvE party members can pickup items of their party members } else { // other players in PvE cannot pickup player's loot if (writeToLog && IsClient) { PveSystem.ClientShowNotificationActionForbidden(); } return(false); } } if (NewbieProtectionSystem.SharedIsNewbie(character)) { // newbie cannot pickup other players' loot if (writeToLog) { NewbieProtectionSystem.SharedShowNewbieCannotDamageOtherPlayersOrLootBags(character, isLootBag: true); } return(false); } // non-newbie character can pickup players' loot // please note this validation has an override for derived ObjectPlayerLootContainerProtected return(true); }
// Use this for initialization void Start() { partySystem = GameObject.Find("Scripts").GetComponent <PartySystem>(); memberFrame = new GameObject[4]; memberFrame[0] = firstMember; memberFrame[1] = secondMember; memberFrame[2] = thirdMember; memberFrame[3] = fourthMember; removeButton.SetActive(true); // 脱退ボタンのメソッド登録 removeButton.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => partySystem.RemoveMemberInParty(PhotonNetwork.player.ID)); removeButton.SetActive(false); }
protected override bool ServerIsCompleted(ICharacter character, PlayerTaskStateWithCount state) { if (base.ServerIsCompleted(character, state)) { return(true); } if (!this.IsSharedWithPartyMembers || !(this.TaskTarget is IProtoQuest)) { return(false); } // check whether any of the other party members has this requirement satisfied var partyMembers = PartySystem.ServerGetPartyMembersReadOnly(character); if (partyMembers.Count <= 1) { // no party or single-player party return(false); } var currentCharacterName = character.Name; foreach (var partyMemberName in partyMembers) { if (partyMemberName == currentCharacterName) { continue; } var partyMember = Api.Server.Characters .GetPlayerCharacter(partyMemberName); if (partyMember == null) { continue; } if (partyMember.SharedGetQuests() .SharedHasCompletedTask(this)) { // party member has satisfied this requirement return(true); } } return(false); }
private static List <ICharacter> ServerGetOnlineStatusChangeReceivers( ICharacter aboutPlayerCharacter) { var list = Server.Characters .EnumerateAllPlayerCharacters(onlyOnline: true) .ToList(); for (var index = 0; index < list.Count; index++) { var character = list[index]; if (ReferenceEquals(character, aboutPlayerCharacter)) { list.RemoveAt(index); break; } } var aboutPlayerCharacterParty = PartySystem.ServerGetParty(aboutPlayerCharacter); List <ICharacter> onlineStatusChangeReceivers; if (ServerIsListHidden) { // only server operators, moderators, and party members will receive a notification onlineStatusChangeReceivers = new List <ICharacter>(list.Count); foreach (var character in list) { if (ServerIsOperatorOrModerator(character) || (aboutPlayerCharacterParty is not null && ReferenceEquals(aboutPlayerCharacterParty, PartySystem.ServerGetParty(character)))) { onlineStatusChangeReceivers.Add(character); } } } else { // all players will receive a notification about the status change for this player onlineStatusChangeReceivers = list; } return(onlineStatusChangeReceivers); }
private void ServerPartyClanTagChanged(ILogicObject party) { // notify other players that have this player in the online players list var serverCharacters = Server.Characters; foreach (var playerCharacterName in PartySystem.ServerGetPartyMembersReadOnly(party)) { var playerCharacter = serverCharacters.GetPlayerCharacter(playerCharacterName); if (playerCharacter is null || !playerCharacter.ServerIsOnline) { continue; } var onlineStatusChangeReceivers = ServerGetOnlineStatusChangeReceivers(playerCharacter); this.CallClient(onlineStatusChangeReceivers, _ => _.ClientRemote_OnlinePlayerClanTagChanged( new Entry(playerCharacter.Name, ServerGetClanTag(playerCharacter)))); } }
private static void SharedCallOnWeaponShot( ICharacter character, IProtoItemWeapon protoWeapon) { if (IsClient) { // start firing weapon on Client-side WeaponSystemClientDisplay.ClientOnWeaponShot(character, partyId: 0, // not relevant here as it's the current player firing the weapon protoWeapon: protoWeapon, protoCharacter: character.ProtoCharacter, fallbackPosition: character.Position.ToVector2Ushort()); } else // if IsServer { using var observers = Shared.GetTempList <ICharacter>(); var eventNetworkRadius = (byte)Math.Max( 15, Math.Ceiling(protoWeapon.SoundPresetWeaponDistance.max)); Server.World.GetCharactersInRadius(character.TilePosition, observers, radius: eventNetworkRadius, onlyPlayers: true); observers.Remove(character); if (observers.Count > 0) { var partyId = PartySystem.ServerGetParty(character)?.Id ?? 0; Instance.CallClient(observers.AsList(), _ => _.ClientRemote_OnWeaponShot(character, partyId, protoWeapon, character.ProtoCharacter, character.Position.ToVector2Ushort())); } } }
public void CmdPartyPromote(int index) { string[] members = party.members; for (int k = 1; k < members.Length; k++) { PartySystem.KickFromParty(party.partyId, name, members[k]); } PartySystem.LeaveParty(party.partyId, name); PartySystem.FormParty(members[index], name); Player invitor = onlinePlayers[members[index]]; for (int a = 1; a < members.Length; a++) { if (a != index) { PartySystem.AddToParty(invitor.party.partyId, members[a]); } } }
public string Execute(ICharacter player) { var party = PartySystem.ServerGetParty(player); if (party is null) { return($"Player \"{player.Name}\" has no party"); } var memberNames = PartySystem.ServerGetPartyMembersReadOnly(party); var sb = new StringBuilder("Player \"") .Append(player.Name) .AppendLine("\" - party info:") .AppendLine("Members list: "); foreach (var memberName in memberNames) { sb.Append(" * ").AppendLine(memberName); } return(sb.ToString()); }
public override void OnButtonClick(int buttonID) { switch ((Buttons)buttonID) { case Buttons.Kick: // PartySystem.RemovePartyMember(Member.Serial); break; case Buttons.GetBar: if (!PartySystem.PartyMemberGumpStack.ContainsKey(Member)) { PartyMemberGump partymemberGump = new PartyMemberGump(Member); UIManager.Add(partymemberGump); PartySystem.PartyMemberGumpStack.Add(Member, partymemberGump); } break; } }
// Use this for initialization protected virtual void Start() { // 通信同期のためのコンポーネントを取得する photonTransformView = gameObject.GetComponent <PhotonTransformView>(); // アニメーションのためのコンポーネントを取得する anim = gameObject.GetComponent <Animator>(); if (photonView.isMine) { // 次に必要な経験値を計算し、格納する nextExp = PlayerStatus.nextLevelExp; // プレイヤーのステータスを取得する playerData = PlayerStatus.playerData; // バフの値を初期化する strBuff = intBuff = defBuff = mndBuff = 1f; // 回転スピードを変更する rotateSpeed = 5f; // プレイヤーの攻撃コンポーネントを取得する playerAttacks = GetComponentsInChildren <PlayerAttack>(); // パーティーシステムを取得する partySystem = GameObject.Find("Scripts").GetComponent <PartySystem>(); // rigbodyを取得する rigbody = gameObject.GetComponent <Rigidbody>(); // キャラクターコントローラーを取得する character = gameObject.GetComponent <CharacterController>(); // サブカメラを探し出し、その数だけ繰り返す foreach (GameObject subCamera in GameObject.FindGameObjectsWithTag("SubCamera")) { // 自分を入れる subCamera.GetComponent <MiniMapCamera>().player = this.gameObject; } // プレイヤーのステータスを送信する StartCoroutine(UpdateStatusOtherPlayers()); } else { // 職業と名前を送らせる photonView.RPC("SendNameAndJob", photonView.owner); } }
public void CmdAcceptInvite() { // valid invitation? // note: no distance check because sender might be far away already if (!InParty() && inviteFrom != "" && Player.onlinePlayers.TryGetValue(inviteFrom, out Player sender)) { // is in party? then try to add if (sender.party.InParty()) { PartySystem.AddToParty(sender.party.party.partyId, name); } // otherwise try to form a new one else { PartySystem.FormParty(sender.name, name); } } // reset party invite in any case inviteFrom = ""; }
private void ServerCharacterJoinedOrLeftPartyHandler( ICharacter playerCharacter, ILogicObject party, bool isJoined) { if (!playerCharacter.ServerIsOnline) { // it's not in online players list so no notifications necessary return; } var onlineStatusChangeReceivers = ServerGetOnlineStatusChangeReceivers(playerCharacter); this.CallClient(onlineStatusChangeReceivers, _ => _.ClientRemote_OnlinePlayerClanTagChanged( new Entry(playerCharacter.Name, ServerGetClanTag(playerCharacter)))); if (!ServerIsListHidden) { return; } // refresh online lists completely for the party members var serverCharacters = Api.Server.Characters; foreach (var characterName in PartySystem.ServerGetPartyMembersReadOnly(party)) { var character = serverCharacters.GetPlayerCharacter(characterName); if (character is not null && character.ServerIsOnline) { this.ServerSendOnlineListAndOtherInfo(character); } } }
// Use this for initialization void Start() { partySystem = GameObject.Find("Scripts").GetComponent<PartySystem>(); }
public void ServerOnSkillExperienceAdded( ICharacter character, double experienceAdded, byte currentLevel) { var multiplier = this.ExperienceToLearningPointsConversionMultiplier * TechConstants.ServerSkillExperienceToLearningPointsConversionMultiplier; // apply reversed experience gain multiplier so faster/slower skill exp gain speed will not affect LP gain speed multiplier /= TechConstants.ServerSkillExperienceGainMultiplier; if (multiplier <= 0 || double.IsNaN(multiplier)) { return; } // reduce LP gain proportionally to the skill level var lpRateMultiplier = MathHelper.Lerp(1, TechConstants.SkillLearningPointMultiplierAtMaximumLevel, currentLevel / (double)this.MaxLevel); multiplier *= lpRateMultiplier; if (multiplier <= 0) { return; } var learningPointsToAdd = experienceAdded * multiplier; var partyMembersNames = this.IsSharingLearningPointsWithPartyMembers ? PartySystem.ServerGetPartyMembersReadOnly(character) : Array.Empty <string>(); if (partyMembersNames.Count <= 1) { // no experience share, no party or a single member party - add all LP to the current character character.SharedGetTechnologies() .ServerAddLearningPoints(learningPointsToAdd); return; } using var onlinePartyMembers = Api.Shared.GetTempList <ICharacter>(); foreach (var partyMemberName in partyMembersNames) { var partyMember = Server.Characters.GetPlayerCharacter(partyMemberName); if (partyMember is null) { continue; } if (ReferenceEquals(partyMember, character) || (partyMember.ServerIsOnline && !CharacterIdleSystem.ServerIsIdlePlayer(partyMember))) { onlinePartyMembers.Add(partyMember); } } if (onlinePartyMembers.Count <= 1 || PartyConstants.PartyLearningPointsSharePercent == 0) { // no party, or a single member party, or no party share % // - add all LP to the current character character.SharedGetTechnologies() .ServerAddLearningPoints(learningPointsToAdd); return; } // player has a party // add only a share of LP to current character var currentCharacterLearningPointsShare = learningPointsToAdd * (1 - PartyConstants.PartyLearningPointsSharePercent); character.SharedGetTechnologies() .ServerAddLearningPoints(currentCharacterLearningPointsShare); // distribute the rest equally to the other party members var learningPointsShare = learningPointsToAdd * PartyConstants.PartyLearningPointsSharePercent / (onlinePartyMembers.Count - 1); foreach (var partyMember in onlinePartyMembers.AsList()) { if (!ReferenceEquals(partyMember, character)) { partyMember.SharedGetTechnologies() .ServerAddLearningPoints(learningPointsShare); } } }
// Use this for initialization void Start() { partySystem = GameObject.Find("Scripts").GetComponent<PartySystem>(); memberFrame = new GameObject[4]; memberFrame[0] = firstMember; memberFrame[1] = secondMember; memberFrame[2] = thirdMember; memberFrame[3] = fourthMember; removeButton.SetActive(true); // 脱退ボタンのメソッド登録 removeButton.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(() => partySystem.RemoveMemberInParty(PhotonNetwork.player.ID)); removeButton.SetActive(false); }
// Use this for initialization void Start() { partySystem = GameObject.Find("PartySystem").GetComponent <PartySystem>(); Camera.main.transparencySortMode = TransparencySortMode.Orthographic; //FMODUnity.RuntimeManager.LowlevelSystem.set3DSettings(100000f, 100000f, 100000f); }
// Use this for initialization protected virtual void Start() { // 通信同期のためのコンポーネントを取得する photonTransformView = gameObject.GetComponent<PhotonTransformView>(); // アニメーションのためのコンポーネントを取得する anim = gameObject.GetComponent<Animator>(); if (photonView.isMine) { // 次に必要な経験値を計算し、格納する nextExp = PlayerStatus.nextLevelExp; // プレイヤーのステータスを取得する playerData = PlayerStatus.playerData; // バフの値を初期化する strBuff = intBuff = defBuff = mndBuff = 1f; // 回転スピードを変更する rotateSpeed = 5f; // プレイヤーの攻撃コンポーネントを取得する playerAttacks = GetComponentsInChildren<PlayerAttack>(); // パーティーシステムを取得する partySystem = GameObject.Find("Scripts").GetComponent<PartySystem>(); // rigbodyを取得する rigbody = gameObject.GetComponent<Rigidbody>(); // キャラクターコントローラーを取得する character = gameObject.GetComponent<CharacterController>(); // サブカメラを探し出し、その数だけ繰り返す foreach (GameObject subCamera in GameObject.FindGameObjectsWithTag("SubCamera")) { // 自分を入れる subCamera.GetComponent<MiniMapCamera>().player = this.gameObject; } // プレイヤーのステータスを送信する StartCoroutine(UpdateStatusOtherPlayers()); } else { // 職業と名前を送らせる photonView.RPC("SendNameAndJob", photonView.owner); } }
// Use this for initialization void Start() { // チャット切り替えボタンのコライダーの参照を取得 buttons[0] = allChatButton.GetComponent<BoxCollider2D>(); buttons[1] = partyChatButton.GetComponent<BoxCollider2D>(); buttons[2] = ptopChatButton.GetComponent<BoxCollider2D>(); buttons[3] = logWindowButton.GetComponent<BoxCollider2D>(); // パーティーシステムを取得 partySystem = GameObject.Find("Scripts").GetComponent<PartySystem>(); // 最小化するためのスクリプトコンポーネントを取得する miniChatWindow = gameObject.GetComponent<MiniChatWindow>(); }