/// <summary>
	/// Displays the drag cursor, which will follow the mouse until hidden
	/// </summary>
	/// <param name="sprite">The sprite to display in the drag cursor</param>
	/// <param name="position">The initial position of the drag cursor</param>
	/// <param name="offset">The mouse offset within the dragged object</param>
	public static void Show( SpellDefinition spell )
	{

		if( spell == null )
		{
			Hide();
			return;
		}

		// Assign label text, which will internally recalculate the label's Size
		_name.Text = spell.Name;
		_info.Text = spell.Description;

		// Resize this control to match the size of the contents
		var labelHeight = _info.RelativePosition.y + _info.Size.y;
		_panel.Height = labelHeight;

		// The tooltip should appear above the mouse
		_cursorOffset = new Vector2( 0, labelHeight + 10 );

		// Display the base panel
		_panel.Show();
		_panel.BringToFront();

		// Call the update function to position the tooltip
		_instance.Update();

	}
Example #2
0
    public void onSpellActivated( SpellDefinition spell )
    {
        if( spell.Name != this.Spell )
            return;

        StartCoroutine( showCooldown() );
    }
Example #3
0
    public void onSpellActivated( SpellDefinition spell )
    {
        if( spell.Name != this.Spell )
            return;

        Debug.Log( "Spell activated: " + spell.Name );

        StartCoroutine( showCooldown() );
    }
Example #4
0
 private void button3_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         SpellDefinition sd = _helper.GetSpell(textBox2.Text);
         if (sd == null)
         {
             sd = new SpellDefinition() { Name = textBox2.Text };
             _helper.Spells.Add(sd);
         }
         sd.Level = int.Parse(textBox3.Text);
         sd.Shool = textBox4.Text;
         sd.Description = textBox5.Text;
         sd.Types = textBox6.Text;
     }
     catch
     {
         MessageBox.Show("Błąd walidacji");
     }
     listView1.ItemsSource = _helper.Spells.OrderBy(s => s.Name);
 }
Example #5
0
 public void onSpellActivated( SpellDefinition spell )
 {
     AddMessage( "You cast " + spell.Name );
 }
Example #6
0
        private void CreateSpellDetailsPage(int page, bool isright, int circle, SpellDefinition spell)
        {
            if (_spellBookType == SpellBookType.Magery)
            {
                AddChildren(new Label(SpellsMagery.CircleNames[circle], false, 0x0288, font: 6)
                {
                    X = isright ? 64 + 162 : 85, Y = 10
                }, page);
            }

            GumpPic spellImage = new GumpPic(isright ? 225 : 62, 40, (Graphic)(spell.GumpIconID - 0x1298), 0)
            {
                LocalSerial = (uint)(Graphic)(spell.GumpIconID - 0x1298), Tag = spell.ID
            };

            spellImage.DragBegin += (sender, e) =>
            {
                GumpControl     ctrl = (GumpControl)sender;
                SpellDefinition def  = SpellsMagery.GetSpell((int)ctrl.Tag);

                UseSpellButtonGump gump = new UseSpellButtonGump(def)
                {
                    X = Mouse.Position.X - 22, Y = Mouse.Position.Y - 22
                };
                UIManager.Add(gump);
                UIManager.AttemptDragControl(gump, Mouse.Position, true);
            };
            AddChildren(spellImage, page);

            Label spellnameLabel = new Label(spell.Name, false, 0x0288, 80, 6)
            {
                X = isright ? 275 : 112, Y = 34
            };

            AddChildren(spellnameLabel, page);

            if (spell.Regs.Length > 0)
            {
                AddChildren(new GumpPicTiled(isright ? 225 : 62, 88, 120, 4, 0x0835), page);

                AddChildren(new Label("Reagents:", false, 0x0288, font: 6)
                {
                    X = isright ? 225 : 62, Y = 92
                }, page);
                string reagList = spell.CreateReagentListString(",\n");

                if (_spellBookType == SpellBookType.Magery)
                {
                    int y = spellnameLabel.Height < 24 ? 31 : 24;
                    y += spellnameLabel.Height;

                    AddChildren(new Label(SpellsMagery.SpecialReagentsChars[spell.ID - 1][1], false, 0x0288, font: 8)
                    {
                        X = isright ? 275 : 112, Y = y
                    }, page);
                }

                AddChildren(new Label(reagList, false, 0x0288, font: 9)
                {
                    X = isright ? 225 : 62, Y = 114
                }, page);
            }
        }
Example #7
0
        private void GetSpellNames(int offset, out string name, out string abbreviature, out string reagents)
        {
            switch (_spellBookType)
            {
            case SpellBookType.Magery:
                SpellDefinition def = SpellsMagery.GetSpell(offset + 1);
                name         = def.Name;
                abbreviature = SpellsMagery.SpecialReagentsChars[offset][1];
                reagents     = def.CreateReagentListString("\n");

                break;

            case SpellBookType.Necromancy:
                def          = SpellsNecromancy.GetSpell(offset + 1);
                name         = def.Name;
                abbreviature = SpellsNecromancy.SpellsSpecialsName[offset][1];
                reagents     = def.CreateReagentListString("\n");

                break;

            case SpellBookType.Chivalry:
                def          = SpellsChivalry.GetSpell(offset + 1);
                name         = def.Name;
                abbreviature = def.PowerWords;
                reagents     = string.Empty;

                break;

            case SpellBookType.Bushido:
                def          = SpellsBushido.GetSpell(offset + 1);
                name         = def.Name;
                abbreviature = def.PowerWords;
                reagents     = string.Empty;

                break;

            case SpellBookType.Ninjitsu:
                def          = SpellsNinjitsu.GetSpell(offset + 1);
                name         = def.Name;
                abbreviature = def.PowerWords;
                reagents     = string.Empty;

                break;

            case SpellBookType.Spellweaving:
                def          = SpellsSpellweaving.GetSpell(offset + 1);
                name         = def.Name;
                abbreviature = def.PowerWords;
                reagents     = string.Empty;

                break;

            case SpellBookType.Mysticism:
                def          = SpellsMysticism.GetSpell(offset + 1);
                name         = def.Name;
                abbreviature = def.PowerWords;
                reagents     = def.CreateReagentListString("\n");

                break;

            default:

                throw new ArgumentOutOfRangeException();
            }
        }
Example #8
0
 public UseSpellButtonGump(SpellDefinition spell) : this()
 {
     _spell = spell;
     BuildGump();
 }
Example #9
0
 public static T SetSpellDefinition <T>(this T entity, SpellDefinition value)
     where T : GuiSpellDefinition
 {
     entity.SetField("<SpellDefinition>k__BackingField", value);
     return(entity);
 }
    public void initSpell()
    {
        Game_Manager gm = GameObject.Find("GameManager").GetComponent <Game_Manager>();

        Debug.Log(gm.spell);
        if (gm.spell != null)
        {
            Debug.Log("arf");
            spellList.Clear();

            List <string>       list  = gm.spell.Shot.Collider;
            SpellColliderType[] array = new SpellColliderType[list.Count];
            int i = 0;
            foreach (string s in list)
            {
                Debug.Log(s);
                array[i] = (SpellColliderType)Enum.Parse(typeof(SpellColliderType), s);
                i++;
            }
            SpellDefinition def = new SpellDefinition("shot", array);
            spellList.Add(def);

            list  = gm.spell.Holohomora.Collider;
            array = new SpellColliderType[list.Count];
            i     = 0;
            foreach (string s in list)
            {
                Debug.Log(s);
                array[i] = (SpellColliderType)Enum.Parse(typeof(SpellColliderType), s);
                i++;
            }
            def = new SpellDefinition("holohomora", array);
            spellList.Add(def);

            list  = gm.spell.Lave.Collider;
            array = new SpellColliderType[list.Count];
            i     = 0;
            foreach (string s in list)
            {
                Debug.Log(s);
                array[i] = (SpellColliderType)Enum.Parse(typeof(SpellColliderType), s);
                i++;
            }
            def = new SpellDefinition("lave", array);
            spellList.Add(def);

            list  = gm.spell.Protego.Collider;
            array = new SpellColliderType[list.Count];
            i     = 0;
            foreach (string s in list)
            {
                Debug.Log(s);
                array[i] = (SpellColliderType)Enum.Parse(typeof(SpellColliderType), s);
                i++;
            }
            def = new SpellDefinition("protego", array);
            spellList.Add(def);
            Debug.Log("def " + spellList.Count);
        }
        foreach (SpellDefinition spell in spellList)
        {
            spellTree.addSpell(new List <SpellColliderType>(spell.colliderOrder), spell.spellName);
        }
        spellTree.DebugTree();
    }
Example #11
0
 public SpellDefinitionContext(SpellDefinition definition, int level)
     : base(DynamicValueHolderType.Spell, level)
 {
 }
Example #12
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus playerStatus))
            {
                if (playerStatus.TryGetSpell(spellInstanceId, out SpellStatus spellStatus))
                {
                    SpellDefinition definition = spellStatus.definition;
                    if (!(null != definition))
                    {
                        yield break;
                    }
                    yield return(definition.LoadResources());

                    ICastTargetDefinition castTarget        = definition.castTarget;
                    CastTargetContext     castTargetContext = castTarget.CreateCastTargetContext(fightStatus, concernedEntity, DynamicValueHolderType.Spell, spellDefId, spellLevel, 0);
                    int count = targets.Count;
                    for (int j = 0; j < count; j++)
                    {
                        castTargetContext.SelectTarget(targets[j].ToTarget(fightStatus));
                    }
                    if (count > 0 && !playerStatus.isLocalPlayer)
                    {
                        CellObject targetedCell = GetTargetedCell(fightStatus, targets[0]);
                        yield return(FightUIRework.ShowPlayingSpell(spellStatus, targetedCell));
                    }
                    List <SpellEffectInstantiationData> spellEffectData = (List <SpellEffectInstantiationData>)definition.spellEffectData;
                    int spellEffectCount = spellEffectData.Count;
                    if (spellEffectCount > 0)
                    {
                        List <IEnumerator> routineList = ListPool <IEnumerator> .Get();

                        int num;
                        for (int i = 0; i < spellEffectCount; i = num)
                        {
                            SpellEffect spellEffect = definition.GetSpellEffect(i);
                            if (!(null == spellEffect))
                            {
                                SpellEffectInstantiationData spellEffectInstantiationData = spellEffectData[i];
                                spellEffectInstantiationData.PreComputeDelayOverDistance(castTargetContext);
                                foreach (Vector2Int item3 in spellEffectInstantiationData.EnumerateInstantiationPositions(castTargetContext))
                                {
                                    IEnumerator item = FightSpellEffectFactory.PlaySpellEffect(spellEffect, item3, spellEffectInstantiationData, castTargetContext);
                                    routineList.Add(item);
                                }
                                foreach (IsoObject item4 in spellEffectInstantiationData.EnumerateInstantiationObjectTargets(castTargetContext))
                                {
                                    IEnumerator item2 = FightSpellEffectFactory.PlaySpellEffect(spellEffect, item4, spellEffectInstantiationData, castTargetContext);
                                    routineList.Add(item2);
                                }
                                yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(routineList.ToArray()));

                                routineList.Clear();
                            }
                            num = i + 1;
                        }
                        ListPool <IEnumerator> .Release(routineList);
                    }
                    FightSpellEffectFactory.SetupSpellEffectOverrides(definition, fightStatus.fightId, eventId);
                }
                else
                {
                    Log.Error($"Could not find spell with instance id {spellInstanceId} for player with id {concernedEntity}.", 128, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 133, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
            }
        }