Example #1
0
        public override void TransferTo(int layerID, int fX, int fY, int pX, int pY, ExtRect area, bool obligatory, bool controlled)
        {
            try {
                NWField field        = Space.GetField(layerID, fX, fY);
                bool    withoutParty = (field.LandID == GlobalVars.Land_Crossroads) || Sail;

                bool globalMove = (LayerID != layerID || Field.X != fX || Field.Y != fY);
                bool partyMove  = (globalMove && controlled && !withoutParty);

                base.TransferTo(layerID, fX, fY, pX, pY, area, obligatory, controlled);

                /*if (globalMove) {
                 *  // ???
                 * }*/

                if (partyMove)
                {
                    try {
                        LeaderBrain party = (LeaderBrain)fBrain;
                        int         num   = party.Members.Count;
                        for (int i = 1; i < num; i++)
                        {
                            NWCreature member = party.Members[i];

                            ExtPoint pt = member.GetNearestPlace(Location, 4, true);
                            if (!pt.IsEmpty)
                            {
                                member.TransferTo(layerID, fX, fY, pt.X, pt.Y, area, obligatory, true);
                            }
                            else
                            {
                                Logger.Write("Player.transferTo().transferParty().getNearestPlace() failed");
                            }
                        }
                    } catch (Exception ex) {
                        Logger.Write("Player.transferTo().transferParty(): " + ex.Message);
                    }
                }
            } catch (Exception ex) {
                Logger.Write("Player.transferTo(): " + ex.Message);
                throw ex;
            }
        }