Exemple #1
0
 public PlayerCharacterRecords(List <byte> rawByteList)
 {
     for (int nRecord = 0; nRecord < TOTAL_CHARACTER_RECORDS; nRecord++)
     {
         byte[] characterArray = new byte[CHARACTER_OFFSET];
         // start at 0x02 byte because the first two characters are 0x0000
         rawByteList.CopyTo(nRecord * CHARACTER_OFFSET, characterArray, 0x00, PlayerCharacterRecord.CHARACTER_RECORD_BYTE_ARRAY_SIZE);
         Records[nRecord] = new PlayerCharacterRecord(characterArray);
     }
 }
Exemple #2
0
        public void SwapPositions(int nFirstPos, int nSecondPos)
        {
            int nActiveRecs = this.TotalPartyMembers();

            if (nFirstPos > nActiveRecs || nSecondPos > nActiveRecs)
            {
                throw new Exception("Asked to swap a party member who doesn't exist First:#" + nFirstPos.ToString()
                                    + " Second:#" + nSecondPos.ToString());
            }

            PlayerCharacterRecord tempRec = Records[nFirstPos];

            Records[nFirstPos]  = Records[nSecondPos];
            Records[nSecondPos] = tempRec;
        }
Exemple #3
0
        /// <summary>
        /// Try to jimmy the door with a given character
        /// </summary>
        /// <param name="xy">position of the door</param>
        /// <param name="record">character who will attempt to open it</param>
        /// <param name="bWasSuccessful">was it a successful jimmy?</param>
        /// <returns>the output string to write to console</returns>
        public string TryToJimmyDoor(Point2D xy, PlayerCharacterRecord record, out bool bWasSuccessful)
        {
            bWasSuccessful = false;
            TileReference tileReference = State.TheVirtualMap.GetTileReference(xy);
            string        retStr;

            bool isDoorInDirection = tileReference.IsOpenable;

            if (!isDoorInDirection)
            {
                retStr = (DataOvlRef.StringReferences.GetString(DataOvlReference.OpeningThingsStrings.NO_LOCK));
            }
            else
            {
                bool bIsDoorMagical = SpriteTileReferences.IsDoorMagical(tileReference.Index);
                bool bIsDoorLocked  = SpriteTileReferences.IsDoorLocked(tileReference.Index);

                if (bIsDoorMagical)
                {
                    // we use up a key
                    State.Keys--;

                    // for now we will also just open the door so we can get around - will address when we have spells
                    if (SpriteTileReferences.IsDoorWithView(tileReference.Index))
                    {
                        State.TheVirtualMap.SetOverridingTileReferece(
                            SpriteTileReferences.GetTileReferenceByName("RegularDoorView"), xy);
                    }
                    else
                    {
                        State.TheVirtualMap.SetOverridingTileReferece(
                            SpriteTileReferences.GetTileReferenceByName("RegularDoor"), xy);
                    }

                    bWasSuccessful = true;

                    retStr = (DataOvlRef.StringReferences.GetString(DataOvlReference.OpeningThingsStrings.KEY_BROKE));
                }
                else if (bIsDoorLocked)
                {
                    // we use up a key
                    State.Keys--;

                    // todo: bh: we will need to determine the likelihood of lock picking success, for now, we always succeed

                    // bh: open player selection dialog here
                    //record.

                    // bh: assume it's me for now

                    if (SpriteTileReferences.IsDoorWithView(tileReference.Index))
                    {
                        State.TheVirtualMap.SetOverridingTileReferece(
                            SpriteTileReferences.GetTileReferenceByName("RegularDoorView"), xy);
                    }
                    else
                    {
                        State.TheVirtualMap.SetOverridingTileReferece(
                            SpriteTileReferences.GetTileReferenceByName("RegularDoor"), xy);
                    }

                    bWasSuccessful = true;
                    retStr         = (DataOvlRef.StringReferences.GetString(DataOvlReference.OpeningThingsStrings.UNLOCKED));
                }
                else
                {
                    retStr = (DataOvlRef.StringReferences.GetString(DataOvlReference.OpeningThingsStrings.NO_LOCK));
                }
            }

            PassTime();
            return(retStr);
        }
Exemple #4
0
        /// <summary>
        /// Adds an NPC character to the party, and maps their CharacterRecord
        /// </summary>
        /// <param name="npc">the NPC to add</param>
        public void AddMemberToParty(NonPlayerCharacterReference npc)
        {
            PlayerCharacterRecord record = CharacterRecords.GetCharacterRecordByNPC(npc);

            record.PartyStatus = PlayerCharacterRecord.CharacterPartyStatus.InParty;
        }
Exemple #5
0
        /// <summary>
        /// Try to jimmy the door with a given character
        /// </summary>
        /// <param name="xy">position of the door</param>
        /// <param name="record">character who will attempt to open it</param>
        /// <param name="bWasSuccesful">was it a successful jimmy?</param>
        /// <returns></returns>
        public string TryToJimmyDoor(Point2D xy, PlayerCharacterRecord record, out bool bWasSuccesful)
        {
            bWasSuccesful = false;
            //Point2D doorPos = GetAdustedPos(CurrentVirtualMap.CurrentPosition, keyCode);
            //int doorTileSprite = GetTileNumber(doorPos.X, doorPos.Y);
            TileReference tileReference     = State.TheVirtualMap.GetTileReference(xy);
            bool          isDoorInDirection = tileReference.IsOpenable;

            if (!isDoorInDirection)
            {
                return(DataOvlRef.StringReferences.GetString(DataOvlReference.OPENING_THINGS_STRINGS.NO_LOCK));
            }

            bool bIsDoorMagical = SpriteTileReferences.IsDoorMagical(tileReference.Index);
            bool bIsDoorLocked  = SpriteTileReferences.IsDoorLocked(tileReference.Index);

            if (bIsDoorMagical)
            {
                // we use up a key
                State.Keys--;

                // for now we will also just open the door so we can get around - will address when we have spells
                if (SpriteTileReferences.IsDoorWithView(tileReference.Index))
                {
                    State.TheVirtualMap.SetOverridingTileReferece(SpriteTileReferences.GetTileReferenceByName("RegularDoorView"), xy);
                }
                else
                {
                    State.TheVirtualMap.SetOverridingTileReferece(SpriteTileReferences.GetTileReferenceByName("RegularDoor"), xy);
                }
                //ReassignSprites();
                bWasSuccesful = true;

                return(DataOvlRef.StringReferences.GetString(DataOvlReference.OPENING_THINGS_STRINGS.KEY_BROKE));
            }
            if (bIsDoorLocked)
            {
                // we use up a key
                State.Keys--;

                // todo: bh: we will need to determine the likelihood of lock picking success, for now, we always succeed

                // bh: open player selection dialog here
                //record.

                // bh: assume it's me for now

                if (SpriteTileReferences.IsDoorWithView(tileReference.Index))
                {
                    State.TheVirtualMap.SetOverridingTileReferece(SpriteTileReferences.GetTileReferenceByName("RegularDoorView"), xy);
                }
                else
                {
                    State.TheVirtualMap.SetOverridingTileReferece(SpriteTileReferences.GetTileReferenceByName("RegularDoor"), xy);
                }
                //ReassignSprites();
                bWasSuccesful = true;
                return(DataOvlRef.StringReferences.GetString(DataOvlReference.OPENING_THINGS_STRINGS.UNLOCKED));
            }
            else
            {
                return(DataOvlRef.StringReferences.GetString(DataOvlReference.OPENING_THINGS_STRINGS.NO_LOCK));
            }
        }
Exemple #6
0
 /// <summary>
 /// Gets the players total defense of all items equipped
 /// </summary>
 /// <param name="record">character record</param>
 /// <returns>the players total defense</returns>
 public int GetCharacterTotalDefense(PlayerCharacterRecord record)
 {
     return(GetDefense(record.Equipped.Amulet) + GetDefense(record.Equipped.Armor) + GetDefense(record.Equipped.Helmet) +
            GetDefense(record.Equipped.LeftHand) + GetDefense(record.Equipped.RightHand) + GetDefense(record.Equipped.Ring));
 }