/// <summary>
 /// Initializes a new instance of the <see cref="CharacterQuestStatusTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="completedOn">The initial value for the corresponding property.</param>
 /// <param name="questID">The initial value for the corresponding property.</param>
 /// <param name="startedOn">The initial value for the corresponding property.</param>
 public CharacterQuestStatusTable(CharacterID @characterID, DateTime? @completedOn, QuestID @questID, DateTime @startedOn)
 {
     CharacterID = @characterID;
     CompletedOn = @completedOn;
     QuestID     = @questID;
     StartedOn   = @startedOn;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GuildMemberTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="guildID">The initial value for the corresponding property.</param>
 /// <param name="joined">The initial value for the corresponding property.</param>
 /// <param name="rank">The initial value for the corresponding property.</param>
 public GuildMemberTable(CharacterID @characterID, GuildID @guildID, DateTime @joined, GuildRank @rank)
 {
     CharacterID = @characterID;
     GuildID     = @guildID;
     Joined      = @joined;
     Rank        = @rank;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryArgs"/> struct.
 /// </summary>
 /// <param name="characterID">The character ID.</param>
 /// <param name="questID">The quest ID.</param>
 /// <param name="characterTemplateID">The character template ID.</param>
 /// <param name="count">The count.</param>
 public QueryArgs(CharacterID characterID, QuestID questID, CharacterTemplateID characterTemplateID, ushort count)
 {
     _characterID         = characterID;
     _questID             = questID;
     _characterTemplateID = characterTemplateID;
     _count = count;
 }
Exemple #4
0
 public override string ToString()
 {
     return("ID: " + CharacterRelationshipID.ToString() +
            "   CharacterID: " + CharacterID.ToString() +
            "   RelationCharacterID: " + RelationCharacterID.ToString() +
            "   RelationTypeID: " + RelationTypeID.ToString());
 }
        ///TODO JLB Fix cPicture Save to use cUtilities
        /// <summary>
        /// Save an picture record to the database. Use this if you have a connection open.
        /// </summary>
        /// <param name="sUserUpdating">Name of the user who is saving the record.</param>
        public void Save(string sUserUpdating)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            if (RecordStatus == RecordStatuses.Delete)
            {
                SortedList sParams = new SortedList();
                sParams.Add("@CharacterItemID", ItemPictureID.ToString());
                cUtilities.LoadDataTable("uspDelCHCharacterItem", sParams, "LARportal", "", lsRoutineName);
            }
            else
            {
                SortedList sParams = new SortedList();
                sParams.Add("@CharacterItemID", ItemPictureID.ToString());
                sParams.Add("@CharacterID", CharacterID.ToString());
                sParams.Add("@ItemDescription", ItemDescription);
                sParams.Add("@ItemPictureID", ItemPictureID.ToString());
                DataTable dtItem = new DataTable();
                dtItem = cUtilities.LoadDataTable("uspInsUpdCHCharacterItems", sParams, "LARportal", "", lsRoutineName);

                foreach (DataRow dRow in dtItem.Rows)
                {
                    int ItemID;
                    if (int.TryParse(dRow["CharacterItemID"].ToString(), out ItemID))
                    {
                        CharacterItemID = ItemID;
                    }
                }
            }
        }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsGuildUserChangeTable"/> class.
 /// </summary>
 /// <param name="guildID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 /// <param name="when">The initial value for the corresponding property.</param>
 public WorldStatsGuildUserChangeTable(GuildID? @guildID, UInt32 @iD, CharacterID @userID, DateTime @when)
 {
     GuildID = @guildID;
     ID      = @iD;
     UserID  = @userID;
     When    = @when;
 }
        // TODO: Class is currently unused because displaying persistent Characters in the editor is not yet supported

        /// <summary>
        /// Initializes a new instance of the <see cref="EditorCharacter"/> class.
        /// </summary>
        /// <param name="table">The <see cref="ICharacterTable"/> describing the character.</param>
        /// <param name="map">The <see cref="Map"/> to place the character on.</param>
        /// <exception cref="ArgumentNullException"><paramref name="table" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="map" /> is <c>null</c>.</exception>
        public EditorCharacter(ICharacterTable table, EditorMap map)
        {
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }
            if (map == null)
            {
                throw new ArgumentNullException("map");
            }

            _table       = table;
            _characterID = table.ID;

            var dbController = DbControllerBase.GetInstance();

            var charInfo = dbController.GetQuery <SelectCharacterByIDQuery>().Execute(_characterID);

            BodyID = charInfo.BodyID;
            Teleport(new Vector2(charInfo.RespawnX, charInfo.RespawnY));
            Resize(BodyInfo.Size);
            Name = charInfo.Name;

            Initialize(map, SkeletonManager.Create(ContentPaths.Build));
        }
        public CharacterStats(CharacterID characterID, SaveData saveData)
        {
            this.characterID = characterID;
            this.saveData    = saveData;

            loadData();
        }
Exemple #9
0
 public int CompareTo(EsiAPITokenInfo other)
 {
     if (other == null)
     {
         throw new ArgumentNullException("other");
     }
     return(CharacterID.CompareTo(other.CharacterID));
 }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterQuestStatusKillsTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="characterTemplateID">The initial value for the corresponding property.</param>
 /// <param name="count">The initial value for the corresponding property.</param>
 /// <param name="questID">The initial value for the corresponding property.</param>
 public CharacterQuestStatusKillsTable(CharacterID @characterID, CharacterTemplateID @characterTemplateID, UInt16 @count,
                                       QuestID @questID)
 {
     CharacterID         = @characterID;
     CharacterTemplateID = @characterTemplateID;
     Count   = @count;
     QuestID = @questID;
 }
Exemple #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsCountNpcKillUserTable"/> class.
 /// </summary>
 /// <param name="count">The initial value for the corresponding property.</param>
 /// <param name="lastUpdate">The initial value for the corresponding property.</param>
 /// <param name="nPCTemplateID">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 public WorldStatsCountNpcKillUserTable(Int32 @count, DateTime @lastUpdate, CharacterTemplateID @nPCTemplateID,
                                        CharacterID @userID)
 {
     Count         = @count;
     LastUpdate    = @lastUpdate;
     NPCTemplateID = @nPCTemplateID;
     UserID        = @userID;
 }
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsCountUserConsumeItemTable"/> class.
 /// </summary>
 /// <param name="count">The initial value for the corresponding property.</param>
 /// <param name="itemTemplateID">The initial value for the corresponding property.</param>
 /// <param name="lastUpdate">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 public WorldStatsCountUserConsumeItemTable(Int32 @count, ItemTemplateID @itemTemplateID, DateTime @lastUpdate,
                                            CharacterID @userID)
 {
     Count          = @count;
     ItemTemplateID = @itemTemplateID;
     LastUpdate     = @lastUpdate;
     UserID         = @userID;
 }
Exemple #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterStatusEffectTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="power">The initial value for the corresponding property.</param>
 /// <param name="statusEffect">The initial value for the corresponding property.</param>
 /// <param name="timeLeftSecs">The initial value for the corresponding property.</param>
 public CharacterStatusEffectTable(CharacterID @characterID, ActiveStatusEffectID @iD, UInt16 @power,
                                   StatusEffectType @statusEffect, UInt16 @timeLeftSecs)
 {
     CharacterID  = @characterID;
     ID           = @iD;
     Power        = @power;
     StatusEffect = @statusEffect;
     TimeLeftSecs = @timeLeftSecs;
 }
Exemple #14
0
        public override int WriteTo(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            cursor += base.WriteTo(Buffer, cursor);
            cursor += CharacterID.WriteTo(Buffer, cursor);

            return(cursor - StartIndex);
        }
Exemple #15
0
        /// <summary>
        /// Tagの名前が一致しているのもを1つ取得する
        /// </summary>
        /// <param name="tag"></param>
        /// <returns>見つからなければnullを返す</returns>
        public static GameObject Find(CharacterID tag)
        {
            find.AddRange(objTemp);
            find.AddRange(objList);
            GameObject find_obj = find.Find(obj => obj.Tag == tag);

            find.Clear();
            return(find_obj);
        }
Exemple #16
0
        /// <summary>
        /// Tagの名前が一致しているすべてを取得する。
        /// </summary>
        /// <param name="tag"></param>
        /// <returns>見つからなければ空のリストを返す</returns>
        public static List <GameObject> FindAll(CharacterID tag)
        {
            find.AddRange(objTemp);
            find.AddRange(objList);
            List <GameObject> find_list = find.FindAll(obj => obj.Tag == tag);

            find.Clear();
            return(find_list);
        }
Exemple #17
0
        public void HandleOpenDialogueResponses()
        {
            currently_has_response_choice_open = true;

            DialogueLine current_dialogue_line = currently_running_dialogue.dialogue_lines[current_running_dialogue_current_line_index];
            CharacterID  line_speaker          = current_dialogue_line.character_speaking_line;

            ClearAllSpeechBubblesExceptFromSpecificCharacter(line_speaker);
            scene_character_to_speech_bubble_controller_mapping[line_speaker].DisplayDialogueResponses(current_dialogue_line.available_responses);
        }
Exemple #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsUserConsumeItemTable"/> class.
 /// </summary>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="itemTemplateID">The initial value for the corresponding property.</param>
 /// <param name="mapID">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 /// <param name="when">The initial value for the corresponding property.</param>
 /// <param name="x">The initial value for the corresponding property.</param>
 /// <param name="y">The initial value for the corresponding property.</param>
 public WorldStatsUserConsumeItemTable(UInt32 @iD, ItemTemplateID @itemTemplateID, MapID? @mapID, CharacterID @userID,
                                       DateTime @when, UInt16 @x, UInt16 @y)
 {
     ID             = @iD;
     ItemTemplateID = @itemTemplateID;
     MapID          = @mapID;
     UserID         = @userID;
     When           = @when;
     X = @x;
     Y = @y;
 }
Exemple #19
0
        /// <summary>
        /// Gets the quest statuses for a character.
        /// </summary>
        /// <param name="characterID">The ID of the character.</param>
        /// <returns>The quest statuses for the character with the given <paramref name="characterID"/>.</returns>
        static IEnumerable <KeyValuePair <IQuest <User>, IEnumerable <KeyValuePair <CharacterTemplateID, ushort> > > > LoadQuestStatuses(
            CharacterID characterID)
        {
            var values = _selectQuestStatusKillsQuery.Execute(characterID);

            return
                (values.Select(
                     x =>
                     new KeyValuePair <IQuest <User>, IEnumerable <KeyValuePair <CharacterTemplateID, ushort> > >(
                         _questManager.GetQuest(x.Key), x.Value)));
        }
Exemple #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsUserLevelTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="level">The initial value for the corresponding property.</param>
 /// <param name="mapID">The initial value for the corresponding property.</param>
 /// <param name="when">The initial value for the corresponding property.</param>
 /// <param name="x">The initial value for the corresponding property.</param>
 /// <param name="y">The initial value for the corresponding property.</param>
 public WorldStatsUserLevelTable(CharacterID @characterID, UInt32 @iD, Byte @level, MapID? @mapID, DateTime @when,
                                 UInt16 @x, UInt16 @y)
 {
     CharacterID = @characterID;
     ID          = @iD;
     Level       = @level;
     MapID       = @mapID;
     When        = @when;
     X           = @x;
     Y           = @y;
 }
            /// <summary>
            /// Tries to get the CharacterID for a Character in the UserAccount by the given index.
            /// </summary>
            /// <param name="index">The 0-based index of the CharacterID.</param>
            /// <param name="value">The CharacterID for the Character at the given <paramref name="index"/>.</param>
            /// <returns>True if the <paramref name="value"/> was successfully acquired; otherwise false.</returns>
            public bool TryGetCharacterID(byte index, out CharacterID value)
            {
                if (index < 0 || index >= _characterIDs.Count)
                {
                    value = new CharacterID(0);
                    return(false);
                }

                value = _characterIDs[index];
                return(true);
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsQuestCancelTable"/> class.
 /// </summary>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="mapID">The initial value for the corresponding property.</param>
 /// <param name="questID">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 /// <param name="when">The initial value for the corresponding property.</param>
 /// <param name="x">The initial value for the corresponding property.</param>
 /// <param name="y">The initial value for the corresponding property.</param>
 public WorldStatsQuestCancelTable(UInt32 @iD, MapID? @mapID, QuestID @questID, CharacterID @userID, DateTime @when,
                                   UInt16 @x, UInt16 @y)
 {
     ID      = @iD;
     MapID   = @mapID;
     QuestID = @questID;
     UserID  = @userID;
     When    = @when;
     X       = @x;
     Y       = @y;
 }
Exemple #23
0
 public Character(CharacterID charcterID, string name, Vector2 position, float radius,
                  GameManager gameManager, ICharacterMediator mediator)
 {
     this.characterID = charcterID;
     this.name        = name;
     this.position    = position;
     this.radius      = radius;
     this.gameManager = gameManager;
     this.mediator    = mediator;
     this.renderer    = gameManager.GetRenderer();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryArgs"/> struct.
 /// </summary>
 /// <param name="guildID">The guild ID.</param>
 /// <param name="charID">The char ID.</param>
 /// <param name="targetID">The target char ID.</param>
 /// <param name="eventID">The event ID.</param>
 /// <param name="arg0">The arg0.</param>
 /// <param name="arg1">The arg1.</param>
 /// <param name="arg2">The arg2.</param>
 public QueryArgs(GuildID guildID, CharacterID charID, CharacterID?targetID, byte eventID, string arg0, string arg1,
                  string arg2)
 {
     GuildID     = guildID;
     CharacterID = charID;
     TargetID    = targetID;
     EventID     = eventID;
     Arg0        = arg0;
     Arg1        = arg1;
     Arg2        = arg2;
 }
 /// <summary>
 /// 全て
 /// </summary>
 /// <param name="name">画像の名前</param>
 /// <param name="position">centerPosを中心(0,0)にした座標</param>
 /// <param name="color">画像の色を変える</param>
 /// <param name="centerPos">画像自体の中心座標,(0,0)は画像の左上</param>
 /// <param name="scale">画像の大きさ 1.0 = 100%</param>
 /// <param name="rectangle">nullなら区切らず画像をそのまま表示</param>
 /// <param name="angle">回転角度(度数法)</param>
 /// <param name="effect">画像の上下反転</param>
 public DrawStruct(CharacterID textureName, Vector2 position, Color color, Vector2 centerPos, Vector2 scale, Rectangle?rectangle = null, float angle = 0.0f, float alpha = 1.0f, SpriteEffects effect = SpriteEffects.None)
 {
     this.textureName = textureName;
     this.position    = position;
     this.rectangle   = rectangle;
     this.color       = color;
     this.angle       = angle;
     this.centerPos   = centerPos;
     this.scale       = scale;
     this.alpha       = alpha;
     this.effect      = effect;
 }
Exemple #26
0
        public void HandleSelectingDialogueResponse()
        {
            currently_has_response_choice_open = false;

            DialogueLine current_dialogue_line = currently_running_dialogue.dialogue_lines[current_running_dialogue_current_line_index];
            CharacterID  line_speaker          = current_dialogue_line.character_speaking_line;

            int selected_response_index        = scene_character_to_speech_bubble_controller_mapping[line_speaker].current_dialogue_response_index;
            DialogueResponse selected_response = current_dialogue_line.available_responses[selected_response_index];

            HandleDialogueLineByIndex(selected_response.next_dialogue_line_index);
        }
Exemple #27
0
        public void HandleDialogueLineByIndex(int index)
        {
            current_running_dialogue_current_line_index = index;

            DialogueLine current_dialogue_line = currently_running_dialogue.dialogue_lines[current_running_dialogue_current_line_index];
            CharacterID  line_speaker          = current_dialogue_line.character_speaking_line;

            current_running_dialogue_next_line_index = current_dialogue_line.next_dialogue_line_index;

            ClearAllSpeechBubblesExceptFromSpecificCharacter(line_speaker);
            scene_character_to_speech_bubble_controller_mapping[line_speaker].DisplayDialogueLine(current_dialogue_line);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GuildEventTable"/> class.
 /// </summary>
 /// <param name="arg0">The initial value for the corresponding property.</param>
 /// <param name="arg1">The initial value for the corresponding property.</param>
 /// <param name="arg2">The initial value for the corresponding property.</param>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="created">The initial value for the corresponding property.</param>
 /// <param name="eventID">The initial value for the corresponding property.</param>
 /// <param name="guildID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="targetCharacterID">The initial value for the corresponding property.</param>
 public GuildEventTable(String @arg0, String @arg1, String @arg2, CharacterID @characterID, DateTime @created,
                        Byte @eventID, GuildID @guildID, Int32 @iD, CharacterID? @targetCharacterID)
 {
     Arg0              = @arg0;
     Arg1              = @arg1;
     Arg2              = @arg2;
     CharacterID       = @characterID;
     Created           = @created;
     EventID           = @eventID;
     GuildID           = @guildID;
     ID                = @iD;
     TargetCharacterID = @targetCharacterID;
 }
Exemple #29
0
 public void ClearAllSpeechBubblesExceptFromSpecificCharacter(CharacterID character_to_exclude_from_clearing)
 {
     foreach (CharacterID id in System.Enum.GetValues(typeof(CharacterID)))
     {
         if (id != character_to_exclude_from_clearing)
         {
             if (scene_character_to_speech_bubble_controller_mapping[id].is_displaying)
             {
                 scene_character_to_speech_bubble_controller_mapping[id].ClearSpeechBubble();
             }
         }
     }
 }
            /// <summary>
            /// Loads and sets the User being used by this account.
            /// </summary>
            /// <param name="world">The World that the User will be part of.</param>
            /// <param name="characterID">The CharacterID of the user to use.</param>
            public void SetUser(World world, CharacterID characterID)
            {
                ThreadAsserts.IsMainThread();

                // Make sure the user is not already set
                if (User != null)
                {
                    const string errmsg = "Cannot use SetUser when the User is not null.";
                    Debug.Fail(errmsg);
                    if (log.IsErrorEnabled)
                    {
                        log.Error(errmsg);
                    }
                    return;
                }

                // Make sure the CharacterID is an ID of a character belonging to this UserAccount
                if (!_characterIDs.Contains(characterID))
                {
                    const string errmsg = "Cannot use CharacterID `{0}` - that character does not belong to this UserAccount.";
                    Debug.Fail(string.Format(errmsg, characterID));
                    if (log.IsErrorEnabled)
                    {
                        log.ErrorFormat(errmsg, characterID);
                    }
                    return;
                }

                // Load the User
                try
                {
                    _user = new User(this, world, characterID);
                }
                catch (Exception ex)
                {
                    const string errmsg = "Failed to create user with ID `{0}`. Exception: {1}";
                    if (log.IsErrorEnabled)
                    {
                        log.ErrorFormat(errmsg, characterID, ex);
                    }
                    Debug.Fail(string.Format(errmsg, characterID, ex));

                    Dispose();
                    return;
                }

                if (log.IsInfoEnabled)
                {
                    log.InfoFormat("Set User `{0}` on account `{1}`.", _user, this);
                }
            }
Exemple #31
0
        public static CharacterType GetTypeByID(CharacterID typeid)
        {
            String path = Properties.Settings.Default.demonsPath;
            switch (typeid)
            {
                case CharacterID.Player:
                    return new CharacterType((int)CharacterID.Player,
                        System.IO.Path.Combine(path, @"characters\dann.png"), 1.5f);

                case CharacterID.Tree:
                    return new CharacterType((int)CharacterID.Tree,
                        System.IO.Path.Combine(path, @"characters\arvore1.png"), 1, 60, 80);

                default:
                    throw new InvalidCharacterTypeException();
                        
            }
        }
        // TODO: Class is currently unused because displaying persistent Characters in the editor is not yet supported

        /// <summary>
        /// Initializes a new instance of the <see cref="EditorCharacter"/> class.
        /// </summary>
        /// <param name="table">The <see cref="ICharacterTable"/> describing the character.</param>
        /// <param name="map">The <see cref="Map"/> to place the character on.</param>
        /// <exception cref="ArgumentNullException"><paramref name="table" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="map" /> is <c>null</c>.</exception>
        public EditorCharacter(ICharacterTable table, EditorMap map)
        {
            if (table == null)
                throw new ArgumentNullException("table");
            if (map == null)
                throw new ArgumentNullException("map");

            _table = table;
            _characterID = table.ID;

            var dbController = DbControllerBase.GetInstance();

            var charInfo = dbController.GetQuery<SelectCharacterByIDQuery>().Execute(_characterID);
            BodyID = charInfo.BodyID;
            Teleport(new Vector2(charInfo.RespawnX, charInfo.RespawnY));
            Resize(BodyInfo.Size);
            Name = charInfo.Name;

            Initialize(map, SkeletonManager.Create(ContentPaths.Build));
        }
Exemple #33
0
        /// <summary>
        /// Creates an <see cref="Action{T}"/> needed for the <see cref="GuildMemberPerformer"/> to save the guild
        /// state of a <see cref="IGuildMember"/>.
        /// </summary>
        /// <param name="dbController"></param>
        /// <returns></returns>
        static Action<IGuildMember> GetSaveHandler(IDbController dbController)
        {
            var replaceQuery = dbController.GetQuery<InsertGuildMemberQuery>();
            var deleteQuery = dbController.GetQuery<DeleteGuildMemberQuery>();

            return delegate(IGuildMember target)
            {
                if (target.Guild == null)
                {
                    var id = new CharacterID(target.ID);
                    deleteQuery.Execute(id);
                }
                else
                {
                    var id = new CharacterID(target.ID);
                    var guildID = target.Guild.ID;
                    var rank = target.GuildRank;
                    var args = new InsertGuildMemberQuery.QueryArgs(id, guildID, rank);
                    replaceQuery.Execute(args);
                }
            };
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsUserLevelTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="level">The initial value for the corresponding property.</param>
 /// <param name="mapID">The initial value for the corresponding property.</param>
 /// <param name="when">The initial value for the corresponding property.</param>
 /// <param name="x">The initial value for the corresponding property.</param>
 /// <param name="y">The initial value for the corresponding property.</param>
 public WorldStatsUserLevelTable(CharacterID @characterID, UInt32 @iD, Byte @level, MapID? @mapID, DateTime @when,
                                 UInt16 @x, UInt16 @y)
 {
     CharacterID = @characterID;
     ID = @iD;
     Level = @level;
     MapID = @mapID;
     When = @when;
     X = @x;
     Y = @y;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterQuestStatusKillsTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="characterTemplateID">The initial value for the corresponding property.</param>
 /// <param name="count">The initial value for the corresponding property.</param>
 /// <param name="questID">The initial value for the corresponding property.</param>
 public CharacterQuestStatusKillsTable(CharacterID @characterID, CharacterTemplateID @characterTemplateID, UInt16 @count,
                                       QuestID @questID)
 {
     CharacterID = @characterID;
     CharacterTemplateID = @characterTemplateID;
     Count = @count;
     QuestID = @questID;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsQuestCancelTable"/> class.
 /// </summary>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="mapID">The initial value for the corresponding property.</param>
 /// <param name="questID">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 /// <param name="when">The initial value for the corresponding property.</param>
 /// <param name="x">The initial value for the corresponding property.</param>
 /// <param name="y">The initial value for the corresponding property.</param>
 public WorldStatsQuestCancelTable(UInt32 @iD, MapID? @mapID, QuestID @questID, CharacterID @userID, DateTime @when,
                                   UInt16 @x, UInt16 @y)
 {
     ID = @iD;
     MapID = @mapID;
     QuestID = @questID;
     UserID = @userID;
     When = @when;
     X = @x;
     Y = @y;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsCountUserConsumeItemTable"/> class.
 /// </summary>
 /// <param name="count">The initial value for the corresponding property.</param>
 /// <param name="itemTemplateID">The initial value for the corresponding property.</param>
 /// <param name="lastUpdate">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 public WorldStatsCountUserConsumeItemTable(Int32 @count, ItemTemplateID @itemTemplateID, DateTime @lastUpdate,
                                            CharacterID @userID)
 {
     Count = @count;
     ItemTemplateID = @itemTemplateID;
     LastUpdate = @lastUpdate;
     UserID = @userID;
 }
 public static uint FindClosestReferenceOfType(CharacterID ID, float X, float Y, float Z, float Radius)
 {
     return FindClosestReferenceOfType((long)ID, X, Y, Z, Radius);
 }
Exemple #39
0
            /// <summary>
            /// Tries to get the CharacterID for a Character in the UserAccount by the given index.
            /// </summary>
            /// <param name="index">The 0-based index of the CharacterID.</param>
            /// <param name="value">The CharacterID for the Character at the given <paramref name="index"/>.</param>
            /// <returns>True if the <paramref name="value"/> was successfully acquired; otherwise false.</returns>
            public bool TryGetCharacterID(byte index, out CharacterID value)
            {
                if (index < 0 || index >= _characterIDs.Count)
                {
                    value = new CharacterID(0);
                    return false;
                }

                value = _characterIDs[index];
                return true;
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsUserShoppingTable"/> class.
 /// </summary>
 /// <param name="amount">The initial value for the corresponding property.</param>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="cost">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="itemTemplateID">The initial value for the corresponding property.</param>
 /// <param name="mapID">The initial value for the corresponding property.</param>
 /// <param name="saleType">The initial value for the corresponding property.</param>
 /// <param name="shopID">The initial value for the corresponding property.</param>
 /// <param name="when">The initial value for the corresponding property.</param>
 /// <param name="x">The initial value for the corresponding property.</param>
 /// <param name="y">The initial value for the corresponding property.</param>
 public WorldStatsUserShoppingTable(Byte @amount, CharacterID @characterID, Int32 @cost, UInt32 @iD,
                                    ItemTemplateID? @itemTemplateID, MapID? @mapID, SByte @saleType, ShopID @shopID,
                                    DateTime @when, UInt16 @x, UInt16 @y)
 {
     Amount = @amount;
     CharacterID = @characterID;
     Cost = @cost;
     ID = @iD;
     ItemTemplateID = @itemTemplateID;
     MapID = @mapID;
     SaleType = @saleType;
     ShopID = @shopID;
     When = @when;
     X = @x;
     Y = @y;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GuildMemberTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="guildID">The initial value for the corresponding property.</param>
 /// <param name="joined">The initial value for the corresponding property.</param>
 /// <param name="rank">The initial value for the corresponding property.</param>
 public GuildMemberTable(CharacterID @characterID, GuildID @guildID, DateTime @joined, GuildRank @rank)
 {
     CharacterID = @characterID;
     GuildID = @guildID;
     Joined = @joined;
     Rank = @rank;
 }
Exemple #42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterTable"/> class.
 /// </summary>
 /// <param name="aIID">The initial value for the corresponding property.</param>
 /// <param name="bodyID">The initial value for the corresponding property.</param>
 /// <param name="cash">The initial value for the corresponding property.</param>
 /// <param name="characterTemplateID">The initial value for the corresponding property.</param>
 /// <param name="chatDialog">The initial value for the corresponding property.</param>
 /// <param name="exp">The initial value for the corresponding property.</param>
 /// <param name="hP">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="level">The initial value for the corresponding property.</param>
 /// <param name="loadMapID">The initial value for the corresponding property.</param>
 /// <param name="loadX">The initial value for the corresponding property.</param>
 /// <param name="loadY">The initial value for the corresponding property.</param>
 /// <param name="moveSpeed">The initial value for the corresponding property.</param>
 /// <param name="mP">The initial value for the corresponding property.</param>
 /// <param name="name">The initial value for the corresponding property.</param>
 /// <param name="respawnMapID">The initial value for the corresponding property.</param>
 /// <param name="respawnX">The initial value for the corresponding property.</param>
 /// <param name="respawnY">The initial value for the corresponding property.</param>
 /// <param name="shopID">The initial value for the corresponding property.</param>
 /// <param name="statPoints">The initial value for the corresponding property.</param>
 /// <param name="statAgi">The initial value for the corresponding property.</param>
 /// <param name="statDefence">The initial value for the corresponding property.</param>
 /// <param name="statInt">The initial value for the corresponding property.</param>
 /// <param name="statMaxhit">The initial value for the corresponding property.</param>
 /// <param name="statMaxhp">The initial value for the corresponding property.</param>
 /// <param name="statMaxmp">The initial value for the corresponding property.</param>
 /// <param name="statMinhit">The initial value for the corresponding property.</param>
 /// <param name="statStr">The initial value for the corresponding property.</param>
 public CharacterTable(AIID? @aIID, BodyID @bodyID, Int32 @cash, CharacterTemplateID? @characterTemplateID,
                       NPCChatDialogID? @chatDialog, Int32 @exp, SPValueType @hP, CharacterID @iD, Byte @level,
                       MapID @loadMapID, UInt16 @loadX, UInt16 @loadY, UInt16 @moveSpeed, SPValueType @mP, String @name,
                       MapID? @respawnMapID, Single @respawnX, Single @respawnY, ShopID? @shopID, Int32 @statPoints,
                       Int16 @statAgi, Int16 @statDefence, Int16 @statInt, Int16 @statMaxhit, Int16 @statMaxhp,
                       Int16 @statMaxmp, Int16 @statMinhit, Int16 @statStr)
 {
     AIID = @aIID;
     BodyID = @bodyID;
     Cash = @cash;
     CharacterTemplateID = @characterTemplateID;
     ChatDialog = @chatDialog;
     Exp = @exp;
     HP = @hP;
     ID = @iD;
     Level = @level;
     LoadMapID = @loadMapID;
     LoadX = @loadX;
     LoadY = @loadY;
     MoveSpeed = @moveSpeed;
     MP = @mP;
     Name = @name;
     RespawnMapID = @respawnMapID;
     RespawnX = @respawnX;
     RespawnY = @respawnY;
     ShopID = @shopID;
     StatPoints = @statPoints;
     SetStat(StatType.Agi, @statAgi);
     SetStat(StatType.Defence, @statDefence);
     SetStat(StatType.Int, @statInt);
     SetStat(StatType.MaxHit, @statMaxhit);
     SetStat(StatType.MaxHP, @statMaxhp);
     SetStat(StatType.MaxMP, @statMaxmp);
     SetStat(StatType.MinHit, @statMinhit);
     SetStat(StatType.Str, @statStr);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterInventoryTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="itemID">The initial value for the corresponding property.</param>
 /// <param name="slot">The initial value for the corresponding property.</param>
 public CharacterInventoryTable(CharacterID @characterID, ItemID @itemID, InventorySlot @slot)
 {
     CharacterID = @characterID;
     ItemID = @itemID;
     Slot = @slot;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EventCountersUserTable"/> class.
 /// </summary>
 /// <param name="counter">The initial value for the corresponding property.</param>
 /// <param name="userEventCounterId">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 public EventCountersUserTable(Int64 @counter, Byte @userEventCounterId, CharacterID @userID)
 {
     Counter = @counter;
     UserEventCounterId = @userEventCounterId;
     UserID = @userID;
 }
Exemple #45
0
        void LoadFromQueryValues(ICharacterTable v)
        {
            Name = v.Name;
            _id = v.ID;
            _templateID = v.CharacterTemplateID;
            MoveSpeed = v.MoveSpeed;

            BodyInfo = BodyInfoManager.Instance.GetBody(v.BodyID);

            Teleport(new Vector2(v.LoadX, v.LoadY));
            Resize(BodyInfo.Size);

            ((PersistentCharacterStatusEffects)StatusEffects).Load();

            // Set the character information
            _level = v.Level;
            _exp = v.Exp;
            _cash = v.Cash;
            _hp = v.HP;
            _mp = v.MP;
            RespawnMapID = v.RespawnMapID;
            RespawnPosition = new Vector2(v.RespawnX, v.RespawnY);
            StatPoints = v.StatPoints;

            _knownSkills = new KnownSkillsCollection(this);

            // Create the AI
            if (v.AIID.HasValue)
            {
                if (!SetAI(v.AIID.Value))
                {
                    const string errmsg = "Failed to set Character `{0}`'s AI to ID `{1}`.";
                    if (log.IsErrorEnabled)
                        log.ErrorFormat(errmsg, this, v.AIID.Value);
                    Debug.Fail(string.Format(errmsg, this, v.AIID.Value));
                    RemoveAI();
                }
            }

            // Load the stats
            BaseStats.CopyValuesFrom(v.Stats);

            // Load the Character's items
            Inventory.Load();
            Equipped.Load();

            // Update the mod stats
            UpdateModStats();

            // Additional loading
            HandleAdditionalLoading(v);

            // Set the map
            var m = World.GetMap(v.LoadMapID);
            if (m != null)
                Teleport(m, Position);
            else
                ((IRespawnable)this).Respawn();

            // Mark the Character as loaded
            SetAsLoaded();

            if (log.IsInfoEnabled)
                log.InfoFormat("Loaded Character `{0}`.", Name);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsNpcKillUserTable"/> class.
 /// </summary>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="mapID">The initial value for the corresponding property.</param>
 /// <param name="nPCTemplateID">The initial value for the corresponding property.</param>
 /// <param name="npcX">The initial value for the corresponding property.</param>
 /// <param name="npcY">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 /// <param name="userLevel">The initial value for the corresponding property.</param>
 /// <param name="userX">The initial value for the corresponding property.</param>
 /// <param name="userY">The initial value for the corresponding property.</param>
 /// <param name="when">The initial value for the corresponding property.</param>
 public WorldStatsNpcKillUserTable(UInt32 @iD, MapID? @mapID, CharacterTemplateID? @nPCTemplateID, UInt16 @npcX,
                                   UInt16 @npcY, CharacterID @userID, Byte @userLevel, UInt16 @userX, UInt16 @userY,
                                   DateTime @when)
 {
     ID = @iD;
     MapID = @mapID;
     NPCTemplateID = @nPCTemplateID;
     NpcX = @npcX;
     NpcY = @npcY;
     UserID = @userID;
     UserLevel = @userLevel;
     UserX = @userX;
     UserY = @userY;
     When = @when;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterSkillTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="skillID">The initial value for the corresponding property.</param>
 /// <param name="timeAdded">The initial value for the corresponding property.</param>
 public CharacterSkillTable(CharacterID @characterID, SkillType @skillID, DateTime @timeAdded)
 {
     CharacterID = @characterID;
     SkillID = @skillID;
     TimeAdded = @timeAdded;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsGuildUserChangeTable"/> class.
 /// </summary>
 /// <param name="guildID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 /// <param name="when">The initial value for the corresponding property.</param>
 public WorldStatsGuildUserChangeTable(GuildID? @guildID, UInt32 @iD, CharacterID @userID, DateTime @when)
 {
     GuildID = @guildID;
     ID = @iD;
     UserID = @userID;
     When = @when;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsCountNpcKillUserTable"/> class.
 /// </summary>
 /// <param name="count">The initial value for the corresponding property.</param>
 /// <param name="lastUpdate">The initial value for the corresponding property.</param>
 /// <param name="nPCTemplateID">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 public WorldStatsCountNpcKillUserTable(Int32 @count, DateTime @lastUpdate, CharacterTemplateID @nPCTemplateID,
                                        CharacterID @userID)
 {
     Count = @count;
     LastUpdate = @lastUpdate;
     NPCTemplateID = @nPCTemplateID;
     UserID = @userID;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ActiveTradeItemTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="itemID">The initial value for the corresponding property.</param>
 public ActiveTradeItemTable(CharacterID @characterID, ItemID @itemID)
 {
     CharacterID = @characterID;
     ItemID = @itemID;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterStatusEffectTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="power">The initial value for the corresponding property.</param>
 /// <param name="statusEffect">The initial value for the corresponding property.</param>
 /// <param name="timeLeftSecs">The initial value for the corresponding property.</param>
 public CharacterStatusEffectTable(CharacterID @characterID, ActiveStatusEffectID @iD, UInt16 @power,
                                   StatusEffectType @statusEffect, UInt16 @timeLeftSecs)
 {
     CharacterID = @characterID;
     ID = @iD;
     Power = @power;
     StatusEffect = @statusEffect;
     TimeLeftSecs = @timeLeftSecs;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountCharacterTable"/> class.
 /// </summary>
 /// <param name="accountID">The initial value for the corresponding property.</param>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="timeDeleted">The initial value for the corresponding property.</param>
 public AccountCharacterTable(AccountID @accountID, CharacterID @characterID, DateTime? @timeDeleted)
 {
     AccountID = @accountID;
     CharacterID = @characterID;
     TimeDeleted = @timeDeleted;
 }
Exemple #53
0
            /// <summary>
            /// Loads and sets the User being used by this account.
            /// </summary>
            /// <param name="world">The World that the User will be part of.</param>
            /// <param name="characterID">The CharacterID of the user to use.</param>
            public void SetUser(World world, CharacterID characterID)
            {
                ThreadAsserts.IsMainThread();

                // Make sure the user is not already set
                if (User != null)
                {
                    const string errmsg = "Cannot use SetUser when the User is not null.";
                    Debug.Fail(errmsg);
                    if (log.IsErrorEnabled)
                        log.Error(errmsg);
                    return;
                }

                // Make sure the CharacterID is an ID of a character belonging to this UserAccount
                if (!_characterIDs.Contains(characterID))
                {
                    const string errmsg = "Cannot use CharacterID `{0}` - that character does not belong to this UserAccount.";
                    Debug.Fail(string.Format(errmsg, characterID));
                    if (log.IsErrorEnabled)
                        log.ErrorFormat(errmsg, characterID);
                    return;
                }

                // Load the User
                try
                {
                    _user = new User(this, world, characterID);
                }
                catch (Exception ex)
                {
                    const string errmsg = "Failed to create user with ID `{0}`. Exception: {1}";
                    if (log.IsErrorEnabled)
                        log.ErrorFormat(errmsg, characterID, ex);
                    Debug.Fail(string.Format(errmsg, characterID, ex));

                    Dispose();
                    return;
                }

                if (log.IsInfoEnabled)
                    log.InfoFormat("Set User `{0}` on account `{1}`.", _user, this);
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterQuestStatusTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="completedOn">The initial value for the corresponding property.</param>
 /// <param name="questID">The initial value for the corresponding property.</param>
 /// <param name="startedOn">The initial value for the corresponding property.</param>
 public CharacterQuestStatusTable(CharacterID @characterID, DateTime? @completedOn, QuestID @questID, DateTime @startedOn)
 {
     CharacterID = @characterID;
     CompletedOn = @completedOn;
     QuestID = @questID;
     StartedOn = @startedOn;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterEquippedTable"/> class.
 /// </summary>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="itemID">The initial value for the corresponding property.</param>
 /// <param name="slot">The initial value for the corresponding property.</param>
 public CharacterEquippedTable(CharacterID @characterID, ItemID @itemID, EquipmentSlot @slot)
 {
     CharacterID = @characterID;
     ItemID = @itemID;
     Slot = @slot;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ActiveTradeCashTable"/> class.
 /// </summary>
 /// <param name="cash">The initial value for the corresponding property.</param>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 public ActiveTradeCashTable(Int32 @cash, CharacterID @characterID)
 {
     Cash = @cash;
     CharacterID = @characterID;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GuildEventTable"/> class.
 /// </summary>
 /// <param name="arg0">The initial value for the corresponding property.</param>
 /// <param name="arg1">The initial value for the corresponding property.</param>
 /// <param name="arg2">The initial value for the corresponding property.</param>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="created">The initial value for the corresponding property.</param>
 /// <param name="eventID">The initial value for the corresponding property.</param>
 /// <param name="guildID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="targetCharacterID">The initial value for the corresponding property.</param>
 public GuildEventTable(String @arg0, String @arg1, String @arg2, CharacterID @characterID, DateTime @created,
                        Byte @eventID, GuildID @guildID, Int32 @iD, CharacterID? @targetCharacterID)
 {
     Arg0 = @arg0;
     Arg1 = @arg1;
     Arg2 = @arg2;
     CharacterID = @characterID;
     Created = @created;
     EventID = @eventID;
     GuildID = @guildID;
     ID = @iD;
     TargetCharacterID = @targetCharacterID;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorldStatsUserConsumeItemTable"/> class.
 /// </summary>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="itemTemplateID">The initial value for the corresponding property.</param>
 /// <param name="mapID">The initial value for the corresponding property.</param>
 /// <param name="userID">The initial value for the corresponding property.</param>
 /// <param name="when">The initial value for the corresponding property.</param>
 /// <param name="x">The initial value for the corresponding property.</param>
 /// <param name="y">The initial value for the corresponding property.</param>
 public WorldStatsUserConsumeItemTable(UInt32 @iD, ItemTemplateID @itemTemplateID, MapID? @mapID, CharacterID @userID,
                                       DateTime @when, UInt16 @x, UInt16 @y)
 {
     ID = @iD;
     ItemTemplateID = @itemTemplateID;
     MapID = @mapID;
     UserID = @userID;
     When = @when;
     X = @x;
     Y = @y;
 }
Exemple #59
0
 //public void Initialize();
 public void Initialize(Texture2D Texture, CharacterID npcType,  Vector2 Position)
 {
     npcEvent = new Event();
     npcEvent.InitializeNPC(npcType);
     base.Initialize(Texture, new Vector2(Position.X, Position.Y-70));
 }
Exemple #60
0
 public void InitializeNPC(CharacterID npcType)
 {
     this.npcType = npcType;
     Active= true;
 }