Exemplo n.º 1
0
 public void UpdateData(NpcHandler npc)
 {
     target         = npc;
     npcLevel.text  = target.level.ToString();
     npcName.text   = target.name;
     powerBar.color = SelectEnergyColorBasedOnPowerType(target.powerType);
 }
Exemplo n.º 2
0
        public void FindOneAndUpdate(NpcHandler npcHandler, ItemHandler itemHandler)
        {
            foreach (Quest quest in Game1.player.questLog)
            {
                if (!quest.completed.Value)
                {
                    bool isValidType = ParseOneByTypeFlag(quest);
                    if (isValidType)
                    {
                        switch (quest.questType.Value)
                        {
                        case 3:
                            UpdateDeliveryQuest(npcHandler, itemHandler, quest);
                            break;

                        case 7:
                            UpdateFishingQuest(npcHandler, itemHandler, quest);
                            break;

                        case 9:
                            UpdateLostItemQuest(npcHandler, itemHandler, quest);
                            break;

                        case 10:
                            UpdateCollectionQuest(npcHandler, itemHandler, quest);
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void OnSelectOption(string displayName)
        {
            string     name       = NpcHandler.Dictionary[displayName];
            NpcHandler npcHandler = new NpcHandler(name);

            if (npcHandler.Target != null)
            {
                if (Config.AllowQuestSubmissions)
                {
                    QuestHandler questHandler = new QuestHandler(this);
                    questHandler.FindOneAndUpdate(npcHandler, itemHandler);

                    if (UseDefaultAction)
                    {
                        ProcessGift(npcHandler);
                    }
                }
                else
                {
                    ProcessGift(npcHandler);
                }

                Exit();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            screenWidth  = graphics.PreferredBackBufferWidth;
            screenHeight = graphics.PreferredBackBufferHeight;

            mainTarget = DefaultTarget;

            tileTarget     = DefaultTarget;
            entityTarget   = DefaultTarget;
            postTileTarget = DefaultTarget;
            screenTarget   = DefaultTarget;

            drawingTarget = DefaultTarget;

            random = new Random();


            cameraPosition = Point.Zero;

            mousePos = new Point();

            TextureHandler.Initialize();

            GameID.Initialize();

            NpcHandler.Initialize();
            LevelHandler.Initialize();
            TileHandler.Initialize();

            base.Initialize();
        }
Exemplo n.º 5
0
        private void UpdateCollectionQuest(NpcHandler npcHandler, ItemHandler itemHandler, Quest quest)
        {
            ResourceCollectionQuest request = (ResourceCollectionQuest)quest;
            bool isValidObjective           = ParseOneByObjective(itemHandler.Item.ParentSheetIndex, request.deliveryItem.Value.ParentSheetIndex);
            bool isValidRecipient           = ParseOneByRecipient(npcHandler.Target.Name, request.target.Value);

            if (isValidObjective && isValidRecipient)
            {
                int  numberItemsOwed = Config.LazyItemChecking ? request.number.Value : request.number.Value - request.numberCollected.Value;
                bool isValidAmount   = Game1.player.hasItemInInventory(itemHandler.Item.ParentSheetIndex, numberItemsOwed);

                if (isValidAmount)
                {
                    // Remove only when quest giver is Robin
                    if (request.target.Value.Equals("Robin"))
                    {
                        itemHandler.RemoveFromInventory(request.number.Value);
                    }

                    npcHandler.Update(0, true, null);
                    Update(quest, request.reward.Value);
                }
                else
                {
                    // Remove none and warn
                    WarnAmountLow(request.target.Value.ToString(), numberItemsOwed);
                }
            }
        }
Exemplo n.º 6
0
        public void Open()
        {
            bool isValidItem = ProcessItemAndReport(itemHandler.Item);

            if (isValidItem && Game1.activeClickableMenu == null && Game1.player.CurrentTool == null)
            {
                List <string> options = NpcHandler.FindKnownNPCs();
                Game1.activeClickableMenu = options != null ? new ChooseFromListMenu(options, OnSelectOption, false) : null;
            }
        }
Exemplo n.º 7
0
        private void ProcessGift(NpcHandler npcHandler)
        {
            string who = npcHandler.Target.Name;

            if (NpcHandler.CanReceiveGiftToday(who))
            {
                int rating = itemHandler.GiftTasteRating(npcHandler);
                npcHandler.Update(rating, false, null);
                itemHandler.RemoveFromInventory(1);
            }
        }
Exemplo n.º 8
0
        public int GiftTasteRating(NpcHandler npcHandler)
        {
            if (Item == null)
            {
                return(0);
            }

            GiftTaste giftTaste = new GiftTaste(Item, npcHandler);

            return(giftTaste.Rating);
        }
Exemplo n.º 9
0
        public RavenClient(ILogger logger, IModuleManager moduleManager, INetworkPacketController controller)
        {
            this.logger  = logger;
            this.Modules = moduleManager;

            this.client             = new RavenNetworkClient(logger, RegisterPacketHandlers(controller));
            this.auth               = this.Modules.AddModule(new Authentication(this.client));
            this.playerHandler      = this.Modules.AddModule(new PlayerHandler());
            this.npcHandler         = this.Modules.AddModule(new NpcHandler());
            this.objectHandler      = this.Modules.AddModule(new ObjectHandler());
            this.npcHandler         = this.Modules.AddModule(new NpcHandler());
            this.characterHandler   = this.Modules.AddModule(new CharacterHandler());
            this.chatMessageHandler = this.Modules.AddModule(new ChatMessageHandler());
        }
Exemplo n.º 10
0
        private void UpdateDeliveryQuest(NpcHandler npcHandler, ItemHandler itemHandler, Quest quest)
        {
            ItemDeliveryQuest request = (ItemDeliveryQuest)quest;
            bool isValidObjective     = ParseOneByObjective(itemHandler.Item.ParentSheetIndex, request.item.Value);
            bool isValidRecipient     = ParseOneByRecipient(npcHandler.Target.Name, request.target.Value);

            // Clint's Attempt
            if (request.id.Value == 110 && isValidObjective && npcHandler.Target.Name.Equals("Emily"))
            {
                itemHandler.RemoveFromInventory(1);
                npcHandler.Update(250, true, "Clint");
                Update(quest, 0);
            }
            else if (isValidRecipient && isValidObjective)
            {
                // Robin's Request
                if (request.id.Value == 113)
                {
                    bool isValidAmount = Game1.player.hasItemInInventory(itemHandler.Item.ParentSheetIndex, 10);
                    if (isValidAmount)
                    {
                        itemHandler.RemoveFromInventory(10);
                        npcHandler.Update(250, true, null);
                        Update(quest, request.moneyReward.Value);
                    }
                    else
                    {
                        // Remove none and warn
                        WarnAmountLow(request.target.Value, 10);
                    }
                }
                else if (quest.dailyQuest.Value)
                {
                    itemHandler.RemoveFromInventory(1);
                    npcHandler.Update(150, true, null);
                    Update(quest, itemHandler.Item.Price * 3);
                }
                else
                {
                    itemHandler.RemoveFromInventory(1);
                    npcHandler.Update(250, true, null);
                    Update(quest, request.moneyReward.Value);
                }
            }
        }
Exemplo n.º 11
0
    public void HandleSpell(int spellId)
    {
        Collider[] enemies = Physics.OverlapSphere(transform.position, 10.0f, enemiesMask);
        foreach (Collider enemy in enemies)
        {
            if (enemy.gameObject == gameObject)
            {
                continue;
            }

            NpcHandler npc = enemy.GetComponent <NpcHandler>();
            if (npc)
            {
                npc.TakeDamage((spellId + 1) * 5.0f);
            }
        }

        TakePower((spellId + 1) * 5);
    }
Exemplo n.º 12
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out RaycastHit hit, 100, interactLayer))
            {
                NpcHandler npc = hit.transform.GetComponent <NpcHandler>();
                if (!npc)
                {
                    return;
                }

                if (npc.GetComponent <PlayerHandler>())
                {
                    return;
                }

                if (!targetRenderer || targetRenderer.gameObject != npc.gameObject)
                {
                    if (targetRenderer)
                    {
                        ToggleOutline(targetRenderer, false);
                    }

                    targetRenderer = npc.GetComponentInChildren <MeshRenderer>();
                    ToggleOutline(targetRenderer, true);
                }

                targetDetailsPanel.UpdateData(npc);
                targetDetailsPanel.gameObject.SetActive(true);
            }
            else
            {
                if (targetRenderer)
                {
                    ToggleOutline(targetRenderer, false);
                    targetRenderer = null;
                }

                targetDetailsPanel.gameObject.SetActive(false);
            }
        }
Exemplo n.º 13
0
 public GameSocket(ISerializer serializer) : base(serializer)
 {
     _bagHandler           = new BagHandler(this);
     _battleHandler        = new BattleHandler(this);
     _dailyActivityHandler = new DailyActivityHandler(this);
     _equipHandler         = new EquipHandler(this);
     _itemHandler          = new ItemHandler(this);
     _messageHandler       = new MessageHandler(this);
     _npcHandler           = new NpcHandler(this);
     _petHandler           = new PetHandler(this);
     _petNewHandler        = new PetNewHandler(this);
     _playerHandler        = new PlayerHandler(this);
     _prepaidHandler       = new PrepaidHandler(this);
     _resourceHandler      = new ResourceHandler(this);
     _skillHandler         = new SkillHandler(this);
     _skillKeysHandler     = new SkillKeysHandler(this);
     _taskHandler          = new TaskHandler(this);
     _teamHandler          = new TeamHandler(this);
     _entryHandler         = new EntryHandler(this);
     _roleHandler          = new RoleHandler(this);
 }
Exemplo n.º 14
0
    private void HandleNpcUpdates()
    {
        var stateChange = NpcHandler.PollEvent();

        if (stateChange == null)
        {
            return;
        }

        switch (stateChange)
        {
        case NpcHealthUpdated healthChange:
            npcManager.OnNpcHealthChanged(healthChange.Entity, healthChange.Health, healthChange.MaxHealth, healthChange.Delta);
            break;

        case NpcDied death:
            npcManager.OnNpcDeath(death.Entity);
            break;

        case NpcRespawned respawn:
            npcManager.OnNpcRespawn(respawn.Entity);
            break;

        case NpcAnimationStateUpdated animation:
            npcManager.OnNpcAnimationStateChanged(animation.Entity, animation.AnimationState, animation.Enabled, animation.Trigger, animation.Action);
            break;

        case EntityAdded <Npc> add:
            npcManager.OnNpcAdded(add.Entity);
            break;

        case EntityUpdated <Npc> updated:
            npcManager.OnNpcUpdated(updated.Entity);
            break;

        case EntityRemoved <Npc> removed:
            npcManager.OnNpcRemoved(removed.Entity);
            break;
        }
    }
Exemplo n.º 15
0
 private void UpdateLostItemQuest(NpcHandler npcHandler, ItemHandler itemHandler, Quest quest)
 {
     if (quest.id.Value == 100 && npcHandler.Target.Name.Equals("Robin") && itemHandler.Item.Name.Equals("Lost Axe"))
     {
         // Robin's Lost Axe
         itemHandler.RemoveFromInventory(1);
         npcHandler.Update(250, true, null);
         Update(quest, 250);
     }
     else if (quest.id.Value == 102 && npcHandler.Target.Name.Equals("Lewis") && itemHandler.Item.Name.Equals("Lucky Purple Shorts"))
     {
         // Mayor's "Shorts"
         itemHandler.RemoveFromInventory(1);
         npcHandler.Update(250, true, null);
         Update(quest, 750);
     }
     else if (quest.id.Value == 107 && npcHandler.Target.Name.Equals("Linus") && itemHandler.Item.Name.Equals("Berry Basket"))
     {
         // Blackberry Basket
         itemHandler.RemoveFromInventory(1);
         npcHandler.Update(250, true, null);
         Update(quest, 0);
     }
 }
Exemplo n.º 16
0
        private void UpdateFishingQuest(NpcHandler npcHandler, ItemHandler itemHandler, Quest quest)
        {
            FishingQuest request          = (FishingQuest)quest;
            bool         isValidObjective = ParseOneByObjective(itemHandler.Item.ParentSheetIndex, request.whichFish.Value);
            bool         isValidRecipient = ParseOneByRecipient(npcHandler.Target.Name, request.target.Value);

            if (isValidObjective && isValidRecipient)
            {
                int  numberItemsOwed = Config.LazyItemChecking ? request.numberToFish.Value : request.numberToFish.Value - request.numberFished.Value;
                bool isValidAmount   = Game1.player.hasItemInInventory(itemHandler.Item.ParentSheetIndex, numberItemsOwed);

                if (isValidAmount)
                {
                    // Remove none
                    npcHandler.Update(0, true, null);
                    Update(quest, request.reward.Value);
                }
                else
                {
                    // Remove none and warn
                    WarnAmountLow(request.target.Value.ToString(), numberItemsOwed);
                }
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            #region textures, fonts, and shaders
            font_Arial      = Content.Load <SpriteFont>("Arial");
            font_Arial_Bold = Content.Load <SpriteFont>("Arial_Bold");



            zoomEffect = Content.Load <Effect>("Effects/Zoom");

            playerTexture = Content.Load <Texture2D>("Player/Player");
            debugTexture  = Content.Load <Texture2D>("Debug");

            mouseTexture = Content.Load <Texture2D>("Gui/MousePointer");

            BuildUi        = Content.Load <Texture2D>("Gui/build_overlay");
            BuildUiPreview = Content.Load <Texture2D>("Gui/PreviewBorder");
            BuildUiFloor   = Content.Load <Texture2D>("Gui/build_overlay_floor");
            BuildUiWall    = Content.Load <Texture2D>("Gui/build_overlay_wall");
            BuildUiObject  = Content.Load <Texture2D>("Gui/build_overlay_object");

            selectedFloorTile  = GetFloorID <AirFloor>();
            selectedWallTile   = GetWallID <AirWall>();
            selectedObjectTile = GetObjectID <AirObject>();

            TileHandler.LoadTileTextures();
            NpcHandler.LoadNpcTextures();
            #endregion

            mainWorld = new World();
            mainWorld.Initialize();

            base.LoadContent();
        }
Exemplo n.º 18
0
 public GameSocket(ISerializer serializer) : base(serializer)
 {
     _achievementHandler       = new AchievementHandler(this);
     _activityHandler          = new ActivityHandler(this);
     _activityFavorHandler     = new ActivityFavorHandler(this);
     _amuletHandler            = new AmuletHandler(this);
     _arenaHandler             = new ArenaHandler(this);
     _attendanceHandler        = new AttendanceHandler(this);
     _bagHandler               = new BagHandler(this);
     _battleHandler            = new BattleHandler(this);
     _cardHandler              = new CardHandler(this);
     _consignmentLineHandler   = new ConsignmentLineHandler(this);
     _crossServerHandler       = new CrossServerHandler(this);
     _dailyActivityHandler     = new DailyActivityHandler(this);
     _demonTowerHandler        = new DemonTowerHandler(this);
     _equipHandler             = new EquipHandler(this);
     _exchangeHandler          = new ExchangeHandler(this);
     _fashionHandler           = new FashionHandler(this);
     _fightLevelHandler        = new FightLevelHandler(this);
     _fleeHandler              = new FleeHandler(this);
     _friendHandler            = new FriendHandler(this);
     _functionHandler          = new FunctionHandler(this);
     _functionOpenHandler      = new FunctionOpenHandler(this);
     _giftOnlineHandler        = new GiftOnlineHandler(this);
     _goddessHandler           = new GoddessHandler(this);
     _guildBlessHandler        = new GuildBlessHandler(this);
     _guildBossHandler         = new GuildBossHandler(this);
     _guildDepotHandler        = new GuildDepotHandler(this);
     _guildHandler             = new GuildHandler(this);
     _guildShopHandler         = new GuildShopHandler(this);
     _guildTechHandler         = new GuildTechHandler(this);
     _hookSetHandler           = new HookSetHandler(this);
     _interactHandler          = new InteractHandler(this);
     _intergalMallHandler      = new IntergalMallHandler(this);
     _itemHandler              = new ItemHandler(this);
     _leaderBoardHandler       = new LeaderBoardHandler(this);
     _limitTimeActivityHandler = new LimitTimeActivityHandler(this);
     _mailHandler              = new MailHandler(this);
     _mapHandler               = new MapHandler(this);
     _masteryHandler           = new MasteryHandler(this);
     _medalHandler             = new MedalHandler(this);
     _messageHandler           = new MessageHandler(this);
     _mountHandler             = new MountHandler(this);
     _npcHandler               = new NpcHandler(this);
     _offlineAwardHandler      = new OfflineAwardHandler(this);
     _onlineGiftHandler        = new OnlineGiftHandler(this);
     _payGiftHandler           = new PayGiftHandler(this);
     _petHandler               = new PetHandler(this);
     _petNewHandler            = new PetNewHandler(this);
     _playerHandler            = new PlayerHandler(this);
     _prepaidHandler           = new PrepaidHandler(this);
     _rankHandler              = new RankHandler(this);
     _resourceDungeonHandler   = new ResourceDungeonHandler(this);
     _resourceHandler          = new ResourceHandler(this);
     _rewardHandler            = new RewardHandler(this);
     _saleHandler              = new SaleHandler(this);
     _shopMallHandler          = new ShopMallHandler(this);
     _skillHandler             = new SkillHandler(this);
     _skillKeysHandler         = new SkillKeysHandler(this);
     _soloHandler              = new SoloHandler(this);
     _stealHandler             = new StealHandler(this);
     _sysSetHandler            = new SysSetHandler(this);
     _taskHandler              = new TaskHandler(this);
     _teamHandler              = new TeamHandler(this);
     _tradeHandler             = new TradeHandler(this);
     _treasureHandler          = new TreasureHandler(this);
     _upLevelHandler           = new UpLevelHandler(this);
     _vipHandler               = new VipHandler(this);
     _vitalityHandler          = new VitalityHandler(this);
     _wingHandler              = new WingHandler(this);
     _activityRevelryHandler   = new ActivityRevelryHandler(this);
     _auctionHandler           = new AuctionHandler(this);
     _chatHandler              = new ChatHandler(this);
     _daoYouHandler            = new DaoYouHandler(this);
     _entryHandler             = new EntryHandler(this);
     _roleHandler              = new RoleHandler(this);
     _farmHandler              = new FarmHandler(this);
     _five2FiveHandler         = new Five2FiveHandler(this);
     _guildManagerHandler      = new GuildManagerHandler(this);
     _xianYuanHandler          = new XianYuanHandler(this);
 }
Exemplo n.º 19
0
            public GiftTaste(Object item, NpcHandler npcHandler)
            {
                string who = npcHandler.Target.Name;

                Rating = (int)(RateByRecipient(npcHandler.Target, item) * RateByCurrentDate(NpcHandler.IsBirthday(who)) * RateByQuality(item.Quality));
            }