/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.FightModeChangingEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="battleStance">The battle stance.</param> /// <param name="chaseMode">if set to <c>true</c> [chase mode].</param> /// <param name="safeMode">if set to <c>true</c> [safe mode].</param> public FightModeChangingEventArgs(CharacterSpawn characterSpawn, BattleStance battleStance, bool chaseMode, bool safeMode) { CharacterSpawn = characterSpawn; BattleStance = battleStance; ChaseMode = chaseMode; SafeMode = safeMode; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.CreatureTalkedEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="speechType">Type of the speech.</param> /// <param name="receiver">The receiver.</param> /// <param name="channelId">The channel identifier.</param> /// <param name="message">The message.</param> public CreatureTalkedEventArgs(CharacterSpawn characterSpawn, SpeechType speechType, string receiver, ushort channelId, string message) { CharacterSpawn = characterSpawn; SpeechType = speechType; Receiver = receiver; ChannelId = channelId; Message = message; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.UsingItemEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="position">The position.</param> /// <param name="stackPosition">The stack position.</param> /// <param name="index">The index.</param> /// <param name="spriteId">The sprite identifier.</param> public UsingItemEventArgs(CharacterSpawn characterSpawn, IVector3 position, byte stackPosition, byte index, ushort spriteId) { CharacterSpawn = characterSpawn; Position = position; StackPosition = stackPosition; Index = index; SpriteId = spriteId; }
/// <summary> /// Determines whether the specified member is inside level range. /// </summary> /// <param name="party">The party.</param> /// <param name="member">The member.</param> /// <returns> /// <c>true</c> if the specified member is inside level range; otherwise, <c>false</c>. /// </returns> public static bool IsInsideLevelRange(this IParty party, CharacterSpawn member) { int highestLevel = party.GetHighestLevel(); int maxLevelDifference = party.GetMaxLevelDifference(highestLevel); int minimumLevel = highestLevel - maxLevelDifference; return(member.Level.Current >= minimumLevel); }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.EditingFriendEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="friend">The friend.</param> /// <param name="friendId">The friend identifier.</param> /// <param name="description">The description.</param> /// <param name="icon">The icon.</param> /// <param name="notifyOnLogin">if set to <c>true</c> [notify on login].</param> public EditingFriendEventArgs(CharacterSpawn characterSpawn, IFriend friend, uint friendId, string description, uint icon, bool notifyOnLogin) { CharacterSpawn = characterSpawn; Friend = friend; FriendId = friendId; Description = description; Icon = icon; NotifyOnLogin = notifyOnLogin; }
/// <summary> /// Determines whether the specified member is inside shared experience range. /// </summary> /// <param name="party">The party.</param> /// <param name="member">The member.</param> /// <returns> /// <c>true</c> if the specified member is inside shared experience range; otherwise, <c>false</c>. /// </returns> public static bool IsInsideSharedExpRange(this IParty party, CharacterSpawn member) { if (party.Leader.Tile == null || member.Tile == null) { return(false); } return(party.Leader.Tile.Position.IsInRange(member.Tile.Position, party.SharedExpMaximumRange)); }
public virtual void OnSpawned(CharacterSpawn spawner) { Live = MaxLive; Boost = 0; isDead = false; isDecayed = false; Debug.Log(this + ", owned by player " + GetOwningPlayer().PlayerIndex + " was spawned!"); if (SpawnedEvent != null) { SpawnedEvent(this, spawner); } }
/// <summary> /// Determines whether this instance can use shared experience with the specified member. /// </summary> /// <param name="party">The party.</param> /// <param name="member">The member.</param> /// <returns> /// <c>true</c> if this instance can use shared experience withthe specified member; otherwise, <c>false</c>. /// </returns> public static bool CanUseSharedExp(this IParty party, CharacterSpawn member) { if (party.Members.Count == 0) { return(false); } if (!party.IsMemberActive(member)) { return(false); } return(party.IsInsideLevelRange(member) && party.IsInsideSharedExpRange(member)); }
public override void OnBeforeEnter() { this.contentPane.MakeFullScreen(); cs = GameObject.Find("Character Spawn").GetComponent <CharacterSpawn>(); cs.Init(); NextButton = this.contentPane.GetChild("NextButton").asButton; PrevButton = this.contentPane.GetChild("PrevButton").asButton; OkButton = this.contentPane.GetChild("OkButton").asButton; UserName = this.contentPane.GetChild("UserName").asTextInput; mask = this.contentPane.GetChild("Mask").asGraph; mask.visible = false; Tran = this.contentPane.GetTransition("ChangeScene"); OkButton.onClick.Add(OnOkButtonDown); NextButton.onClick.Add(cs.OnNextButtonDown); PrevButton.onClick.Add(cs.OnPrevButtonDown); }
private void Start() { //singelton if (CharacterSpawn.spawn == null) { CharacterSpawn.spawn = this; } else { if (CharacterSpawn.spawn != this) { Destroy(CharacterSpawn.spawn.gameObject); CharacterSpawn.spawn = this; } } }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="characterSpawn">The character spawn.</param> /// <param name="type">The type.</param> /// <param name="statementId">The statement identifier.</param> /// <param name="text">The text.</param> public static void Add(NetworkMessage message, CharacterSpawn characterSpawn, SpeechType type, uint statementId, string text) { message.AddPacketType(GamePacketType.CreatureSpeech); message.AddUInt32(statementId); if (characterSpawn != null) { message.AddString(characterSpawn.Character.Name); message.AddUInt16((ushort)characterSpawn.Level.Current); } else { // TODO: Is this a magic number? message.AddUInt32(0x00); } message.AddSpeechType(type); message.AddString(text); }
public void ClientEvent_SubmitSpawnCharacter(Client client, int selectedCharId) { if (!client.IsLoggedIn()) { return; } if (selectedCharId < 0) { return; } TaskManager.Run(client, async() => { var chData = await CharacterModel.ReadAsync(selectedCharId); if (chData == null) { client.SendChatMessage("Error retriving char. Bad char id?"); return; } var accData = client.GetAccount(); if (chData.CharOwnerID != accData.ID) { client.SendChatMessage("That is not your character. Ban/Kick?"); return; } accData.LastSpawnedCharId = selectedCharId; client.Dimension = 0; client.Transparency = 255; client.SendChatMessage("TODO: Teleport to last known position here"); client.Position = new Vector3(-173.1077, 434.9248, 111.0801); // dummy client.SetActiveChar(chData); client.Name = chData.CharacterName.Replace("_", " "); client.TriggerEvent(Events.ServerToClient.Character.EndCharSelector); // Invoke Character Spawn Listeners CharacterSpawn?.Invoke(client, EventArgs.Empty); }); }
/// <summary> /// Spawns in the first module of this level. /// </summary> static void InitialCreate() { for (int i = 0; i < sectorNumber.Length; i++) { sectorNumber[i] = 0; } int maxSpawns = Mathf.Min(2, ControllerManager.Get().MaximumUsable); for (int i = 0; i < maxSpawns; i++) { Player p = PlayerManager.Get().GetPlayer(i); PlayerNextSector(currentLevel.Sectors[0], p); ICharacter c = Create(p); UseCharacter(p, c); CharacterSpawn spawner = currentSectors[p.PlayerIndex].SpawnModule.Spawns[(int)c.CharacterType]; c.Spawn(spawner); } started = true; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.CreatureTurnedEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> public CreatureTurnedEventArgs(CharacterSpawn characterSpawn) { CharacterSpawn = characterSpawn; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.ClosedChannelEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="channel">The channel.</param> public ClosedChannelEventArgs(CharacterSpawn characterSpawn, IChannel channel) { CharacterSpawn = characterSpawn; Channel = channel; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.CharacterWalkedEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="direction">The direction.</param> public CharacterWalkedEventArgs(CharacterSpawn characterSpawn, Direction direction) { CharacterSpawn = characterSpawn; Direction = direction; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.OpeningChannelEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="channel">The channel.</param> public OpeningChannelEventArgs(CharacterSpawn characterSpawn, IChannel channel) { CharacterSpawn = characterSpawn; Channel = channel; }
public void RequestCharacterSpawn(CharacterSpawn spawn) { m_spawns.Add(spawn); }
/// <summary> /// Called when [requested login data]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="LoginDataEventArgs" /> instance containing the event data.</param> private void OnRequestedLoginData(object sender, LoginDataEventArgs e) { World world = new World(); world.IpAddress = "127.0.0.1"; world.IsPreview = true; world.Port = 7172; world.Id = 0; world.Name = "Draconia"; e.Worlds.Add(world); Character character = new Character(); character.Id = 1; character.Name = "Chuitox"; character.Status = SessionStatus.Online; character.Settings.CanBroadcast = true; character.Settings.CanChangeSex = true; character.Settings.CanSeeDiagnostics = true; character.Settings.CanSeeGhosts = true; character.Settings.CanTeleport = true; _characterSpawn = new CharacterSpawn(); _characterSpawn.AccountId = 1; _characterSpawn.Amulet = null; _characterSpawn.AmuletId = null; _characterSpawn.AxeSkill = new Skill { Base = 10, Current = 100, Experience = 1000, NextLevelExperience = 1100 }; _characterSpawn.Balance = 1000000; _characterSpawn.BattleStance = BattleStance.Defense; _characterSpawn.Belt = null; _characterSpawn.BeltId = null; _characterSpawn.Blessings = 7; _characterSpawn.Capacity = 300; _characterSpawn.Character = character; _characterSpawn.CharacterId = 1; _characterSpawn.ClubSkill = new Skill { Base = 10, Current = 100, Experience = 1000, NextLevelExperience = 1100 }; _characterSpawn.Conditions = Conditions.Bleeding | Conditions.Burning | Conditions.Cursed | Conditions.Dazzled | Conditions.Drowning | Conditions.Strengthened; _characterSpawn.Container = null; _characterSpawn.ContainerId = null; _characterSpawn.CreationTime = DateTime.UtcNow; _characterSpawn.Creature = character; _characterSpawn.DeletionTime = null; _characterSpawn.Direction = Direction.East; _characterSpawn.DistanceSkill = new Skill { Base = 10, Current = 100, Experience = 1000, NextLevelExperience = 1100 }; _characterSpawn.DrunkCondition = null; _characterSpawn.ExhaustCondition = null; _characterSpawn.Feet = null; _characterSpawn.FeetId = null; _characterSpawn.FishingSkill = new Skill { Base = 10, Current = 100, Experience = 1000, NextLevelExperience = 1100 }; _characterSpawn.FistSkill = new Skill { Base = 10, Current = 100, Experience = 1000, NextLevelExperience = 1100 }; _characterSpawn.FollowOpponent = true; _characterSpawn.FreeCapacity = 250; _characterSpawn.Guild = null; _characterSpawn.GuildLevel = 0; _characterSpawn.Head = null; _characterSpawn.HeadId = null; _characterSpawn.Health.Current = 100; _characterSpawn.Health.Maximum = 1000; _characterSpawn.Id = 0; //characterSpawn.IsDead = false; //characterSpawn.IsDrunk = false; //characterSpawn.IsExhausted = false; // TODO: This must be handled differently _characterSpawn.IsMountToggleExhausted = false; //characterSpawn.IsPoisoned = false; _characterSpawn.LastLogin.IpAddress = "127.0.0.1"; _characterSpawn.LastLogin.Time = DateTime.UtcNow; _characterSpawn.LastLogout = null; _characterSpawn.LastPing = DateTime.MinValue; _characterSpawn.Legs = null; _characterSpawn.LegsId = null; _characterSpawn.Level.Current = 9; _characterSpawn.Level.Experience = 1000; _characterSpawn.Level.NextLevelExperience = 1100; _characterSpawn.LightInfo.Level = LightLevel.Torch; _characterSpawn.LightInfo.Color = LightColor.Default; _characterSpawn.MagicLevel.Base = 100; _characterSpawn.MagicLevel.Bonus = 10; _characterSpawn.MagicLevel.Experience = 1000; _characterSpawn.MagicLevel.NextLevelExperience = 1100; _characterSpawn.Mana.Current = 100; _characterSpawn.Mana.Maximum = 1000; _characterSpawn.Mana.Spent = 100; _characterSpawn.Mount = _mountService.GetMountBySpriteId(373); // TODO: This should be initialized by the constructor _characterSpawn.IsRiding = true; _characterSpawn.Mounts.AddRange(_mountService.GetAll()); _characterSpawn.OfflineTraining.Elapsed = TimeSpan.Zero; _characterSpawn.OfflineTraining.Skill = new Skill { Base = 10, Current = 100, Experience = 1000, NextLevelExperience = 1100 }; _characterSpawn.OnlineTime = TimeSpan.Zero; // TODO: Containers open //characterSpawn.OpenContainers = null; _characterSpawn.Outfit = _outfitService.GetOutfitBySpriteId(147); // TODO: This should be initialized by the constructor _characterSpawn.Outfits.AddRange(_outfitService.GetAll()); _characterSpawn.PartyId = null; // TODO: This should be initialized by the constructor _characterSpawn.PartyInvitations = new IParty[0]; _characterSpawn.PoisonCondition = null; // TODO: This should be initialized by the constructor _characterSpawn.Quests = new IQuestInfo[0]; // TODO: This should be initialized by the constructor _characterSpawn.RegenerationConditions = new RegenerationCondition[0]; _characterSpawn.Ring = null; _characterSpawn.RingId = null; _characterSpawn.Sex = Sex.Male; _characterSpawn.Shield = null; _characterSpawn.ShieldId = null; _characterSpawn.ShieldSkill = new Skill { Base = 10, Current = 100, Experience = 1000, NextLevelExperience = 1100 }; _characterSpawn.Skull.Type = SkullType.None; _characterSpawn.Skull.Time = TimeSpan.Zero; _characterSpawn.Soul = 200; _characterSpawn.Speed.BaseSpeed = 100; _characterSpawn.Speed.BonusSpeed = 100; _characterSpawn.Stamina = 400; _characterSpawn.SwordSkill = new Skill { Base = 10, Current = 100, Experience = 1000, NextLevelExperience = 1100 }; ITile tile = _tileService.GetTileByPosition(new Vector3(168, 493, 7)); //Tile tile = new Tile(); //tile.Flags = TileFlags.None; //tile.Position = new Vector3(168, 492, 7); //tile.Items.Add(new ItemSpawn //{ // Item = _itemService.GetItemById(406), // ItemId = 406, // LightInfo = new LightInfo // { // Color = LightColor.Default, // Level = LightLevel.Torch // }, // StackPosition = 0, // Tile = tile //}); // TODO: This has to be a valid tile of the map _characterSpawn.Tile = tile; _characterSpawn.StackPosition = 1; _characterSpawn.Torso = null; _characterSpawn.TorsoId = null; _characterSpawn.TownId = 1; _characterSpawn.Town = _townService.GetTownById(_characterSpawn.TownId); _characterSpawn.UseSecureMode = true; _characterSpawn.VocationId = 0; _characterSpawn.Vocation = _vocationService.GetVocationById(_characterSpawn.VocationId); _characterSpawn.WarIcon = WarIcon.None; _characterSpawn.Weapon = null; _characterSpawn.WeaponId = null; _characterSpawn.WorldId = 0; e.Characters.Add(_characterSpawn); Friend friend = new Friend(); friend.Character = _characterSpawn.Character; friend.CharacterId = _characterSpawn.Character.Id; friend.Id = 1; friend.Description = "Test"; friend.NotifyOnLogin = true; IAccount account = e.Account; account.ClientVersion = 100; account.Notification = null; account.OSPlatform = OSPlatform.Windows; account.Password = "******"; account.PremiumExpirationDate = DateTime.UtcNow.AddYears(1); account.UserName = "******"; account.Friends.Add(friend); friend.Account = account; friend.AccountId = account.Id; account.CharacterSpawns.Add(_characterSpawn); _characterSpawn.Account = account; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.AutoWalkingEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="directions">The directions.</param> public AutoWalkingEventArgs(CharacterSpawn characterSpawn, Queue <Direction> directions) { CharacterSpawn = characterSpawn; Directions = directions; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.LoggingOutEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> public LoggingOutEventArgs(CharacterSpawn characterSpawn) { CharacterSpawn = characterSpawn; }
/// <summary> /// Gets the party shield. /// </summary> /// <param name="self">The self.</param> /// <param name="member">The member.</param> /// <returns>The party shield.</returns> public static PartyShield GetPartyShield(this ICharacterSpawn self, CharacterSpawn member) { if (member?.Party == null) { return(PartyShield.None); } if (self.Party != null) { if (self.Party.Leader == member) { if (!self.Party.IsActivelySharingExp) { return(PartyShield.Leader); } if (self.Party.HasSharedExpEnabled) { return(PartyShield.LeaderSharedExp); } if (self.Party.CanUseSharedExp(member)) { return(PartyShield.LeaderSharedExpInactive); } return(PartyShield.LeaderNoSharedExp); } if (self.Party == member.Party) { if (!self.Party.IsActivelySharingExp) { return(PartyShield.Member); } if (self.Party.HasSharedExpEnabled) { return(PartyShield.MemberSharedExp); } if (self.Party.CanUseSharedExp(member)) { return(PartyShield.MemberSharedExpInactive); } return(PartyShield.MemberNoSharedExp); } if (member.PartyInvitations.Contains(self.Party)) { return(PartyShield.Guest); } return(PartyShield.None); } if (member.Party.Leader == member && self.PartyInvitations.Contains(member.Party)) { return(PartyShield.Host); } return(PartyShield.OtherPartyMember); }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.RemovingFriendEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="friend">The friend.</param> /// <param name="friendId">The friend identifier.</param> public RemovingFriendEventArgs(CharacterSpawn characterSpawn, IFriend friend, uint friendId) { CharacterSpawn = characterSpawn; Friend = friend; FriendId = friendId; }
public override void OnSpawned(CharacterSpawn spawner) { base.OnSpawned(spawner); }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.DisconnectedEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> public DisconnectedEventArgs(CharacterSpawn characterSpawn) { CharacterSpawn = characterSpawn; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.RemovedFriendEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="friend">The friend.</param> public RemovedFriendEventArgs(CharacterSpawn characterSpawn, IFriend friend) { CharacterSpawn = characterSpawn; Friend = friend; }
/// <summary> /// Determines whether the specified member is active. /// </summary> /// <param name="party">The party.</param> /// <param name="member">The member.</param> /// <returns> /// <c>true</c> if the specified member is active; otherwise, <c>false</c>. /// </returns> public static bool IsMemberActive(this IParty party, CharacterSpawn member) { // TODO: Check if member is in combat return(true); }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.SentChannelListEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> public SentChannelListEventArgs(CharacterSpawn characterSpawn) { CharacterSpawn = characterSpawn; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.ToggledMountEventArgs" /> class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> public ToggledMountEventArgs(CharacterSpawn characterSpawn) { CharacterSpawn = characterSpawn; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.RequestingAppearanceChangeEventArgs" /> /// class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="outfit">The outfit.</param> /// <param name="mount">The mount.</param> public RequestingAppearanceChangeEventArgs(CharacterSpawn characterSpawn, IOutfit outfit, IMount mount) { CharacterSpawn = characterSpawn; Outfit = outfit; Mount = mount; }