public override void Execute(GameLiving living) { if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) { return; } GamePlayer player = living as GamePlayer; ItemTemplate arrow_summoning_1 = GameServer.Database.FindObjectByKey <ItemTemplate>("arrow_summoning1"); ItemTemplate arrow_summoning_2 = GameServer.Database.FindObjectByKey <ItemTemplate>("arrow_summoning2"); ItemTemplate arrow_summoning_3 = GameServer.Database.FindObjectByKey <ItemTemplate>("arrow_summoning3"); // what are these used for? - tolakram WorldInventoryItem as1 = WorldInventoryItem.CreateFromTemplate(arrow_summoning_1); WorldInventoryItem as2 = WorldInventoryItem.CreateFromTemplate(arrow_summoning_2); WorldInventoryItem as3 = WorldInventoryItem.CreateFromTemplate(arrow_summoning_3); if (!player.Inventory.AddTemplate(GameInventoryItem.Create(arrow_summoning_1), 10, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack)) { player.Out.SendMessage("You do not have enough inventory space to place this item!", eChatType.CT_System, eChatLoc.CL_SystemWindow); } else if (!player.Inventory.AddTemplate(GameInventoryItem.Create(arrow_summoning_2), 10, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack)) { player.Out.SendMessage("You do not have enough inventory space to place this item!", eChatType.CT_System, eChatLoc.CL_SystemWindow); } else if (!player.Inventory.AddTemplate(GameInventoryItem.Create(arrow_summoning_3), 10, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack)) { player.Out.SendMessage("You do not have enough inventory space to place this item!", eChatType.CT_System, eChatLoc.CL_SystemWindow); } GameEventMgr.AddHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerQuit)); DisableSkill(living); }
/// <summary> /// Do the combine. /// </summary> /// <param name="target"></param> /// <param name="effectiveness"></param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GamePlayer player = Caster as GamePlayer; if (player == null) { return; } InventoryItem useItem = player.UseItem; if (useItem == null || !ArtifactMgr.IsArtifactScroll(useItem)) { return; } WorldInventoryItem combinedScroll = WorldInventoryItem.CreateFromTemplate("artifact_scroll"); if (combinedScroll == null) { return; } combinedScroll.AddOwner(player); combinedScroll.Name = useItem.Name; combinedScroll.Item.Name = useItem.Name; var backpack = player.Inventory.GetItemRange(eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack); ArrayList removeItems = new ArrayList(); removeItems.Add(useItem); bool combinesToBook = false; foreach (InventoryItem item in backpack) { if (item == null) { continue; } if (ArtifactMgr.CanCombine(combinedScroll.Item, item)) { combinedScroll = ArtifactMgr.CombineScrolls(combinedScroll.Item, item, ref combinesToBook); removeItems.Add(item); if (combinesToBook) { break; } } } player.Out.SendSpellEffectAnimation(player, player, 1, 0, false, 1); Artifact artifact = ArtifactMgr.GetArtifact(combinedScroll.Item); if (artifact == null) { log.Warn(String.Format("Missing artifact for item '{0}'", combinedScroll.Name)); } else { String receiveMessage = (combinesToBook) ? artifact.MessageReceiveBook : artifact.MessageReceiveScrolls; player.Out.SendMessage(String.Format(receiveMessage, combinedScroll.Name, useItem.Name), eChatType.CT_Skill, eChatLoc.CL_SystemWindow); } if (player.ReceiveItem(player, combinedScroll)) { foreach (InventoryItem item in removeItems) { player.Inventory.RemoveItem(item); InventoryLogging.LogInventoryAction(player, "(ARTIFACT;CombineScrolls)", eInventoryActionType.Quest, item.Template, item.Count); } } }