diff --git a/src/DB/Emotions.js b/src/DB/Emotions.js index e329453..7bcb325 100644 --- a/src/DB/Emotions.js +++ b/src/DB/Emotions.js @@ -257,17 +257,29 @@ define(function() // ET_PANIC = 79 [ 78, 62, "panic", "e32", "øÈ²" ], - // ET_WHISP = 80 - [ 79, 63, "whisp", "e33", "À§½ºÆÛ" ] - -/* -80 ! quest -81 ? quest -82 ! job -83 ? job -84 ! special -85 ? special -*/ + // ET_WHISP = 80 + [ 79, 63, "whisp", "e33", "À§½ºÆÛ" ], + + // ET_!QUEST = 81 / 0 + [ 80, -1 ], + + // ET_?QUEST = 82 / 1 + [ 81, -1 ], + + // ET_!JOB = 83 / 2 + [ 82, -1 ], + + // ET_?JOB = 84 / 3 + [ 83, -1 ], + + // ET_!EVENT = 85 / 4 + [ 84, -1 ], + + // ET_?EVENT = 86 / 5 + [ 85, -1 ], + + // ET_??? = 87 / 6 + [ 86, -1 ] ]; var i, j, count, size; diff --git a/src/Engine/MapEngine/Entity.js b/src/Engine/MapEngine/Entity.js index 0cef6b0..684d7d8 100644 --- a/src/Engine/MapEngine/Entity.js +++ b/src/Engine/MapEngine/Entity.js @@ -39,6 +39,7 @@ define(function( require ) var StatusIcons = require('UI/Components/StatusIcons/StatusIcons'); var BasicInfo = require('UI/Components/BasicInfo/BasicInfo'); var Escape = require('UI/Components/Escape/Escape'); + var MiniMap = require('UI/Components/MiniMap/MiniMap'); /** @@ -478,6 +479,57 @@ define(function( require ) } + /** + * Shows notification effect for quests and events + * + * @param {object} pkt - PACKET.ZC.QUEST_NOTIFY_EFFECT + */ + function onEntityQuestNotifyEffect( pkt ) { + var Entity = EntityManager.get(pkt.npcID); + var color = 0; + + if (pkt.effect !== 9999) { + var emotionId = pkt.effect + 81; + + if (Entity && (pkt.effect in Emotions.indexes)) { + Entity.attachments.add({ + frame: Emotions.indexes[emotionId], + file: 'emotion', + play: true, + head: true, + repeat: true, + depth: 5.0 + }); + } + + } + + switch (pkt.color + 1) { + case 1: + // yellow + color = 0xffff00; + break; + case 2: + // orange + color = 0xffa500; + break; + case 3: + // green + color = 0x00e16a; + break; + case 4: + // purple + color = 0x800080; + break; + case 0: + default: + return; + } + + MiniMap.addNpcMark( pkt.npcID, pkt.xPos, pkt.yPos, color, Infinity); + } + + /** * Updating entity direction * @@ -1024,5 +1076,6 @@ define(function( require ) Network.hookPacket( PACKET.ZC.RESURRECTION, onEntityResurect); Network.hookPacket( PACKET.ZC.EMOTION, onEntityEmotion); Network.hookPacket( PACKET.ZC.NOTIFY_MONSTER_HP, onEntityLifeUpdate); - }; + Network.hookPacket( PACKET.ZC.QUEST_NOTIFY_EFFECT, onEntityQuestNotifyEffect); + }; }); \ No newline at end of file diff --git a/src/Network/PacketStructure.js b/src/Network/PacketStructure.js index 554381f..51c28b2 100644 --- a/src/Network/PacketStructure.js +++ b/src/Network/PacketStructure.js @@ -9451,7 +9451,7 @@ define(['Utils/BinaryWriter', './PacketVerManager'], function(BinaryWriter, PACK this.xPos = fp.readShort(); this.yPos = fp.readShort(); this.effect = fp.readShort(); - this.type = fp.readShort(); + this.color = fp.readShort(); }; PACKET.ZC.QUEST_NOTIFY_EFFECT.size = 14; diff --git a/src/UI/Components/ItemInfo/ItemInfo.css b/src/UI/Components/ItemInfo/ItemInfo.css index 85fb8a4..4f2ee88 100644 --- a/src/UI/Components/ItemInfo/ItemInfo.css +++ b/src/UI/Components/ItemInfo/ItemInfo.css @@ -1,10 +1,11 @@ .ItemInfo { position:absolute; top:0px; left:0px; width:280px; background-repeat:no-repeat; background-color:transparent; } -.ItemInfo .container { height:120px; position:relative; } +.ItemInfo .container { height:120px; position:relative; box-shadow: white 0px 0px 0px 3px inset, rgb(192, 192, 192) 0px 0px 0px 4px inset; background-repeat: no-repeat; background-color: white; border-radius: 10px; } .ItemInfo .view { position:absolute; width:42px; height:20px; background-repeat:no-repeat; background-color:transparent; border:none; top:6px; left:6px; } .ItemInfo .collection { position:absolute; top:11px; left:10px; width:75px; height:100px; background-repeat:no-repeat; background-color:transparent; } .ItemInfo .title { position:absolute; top:3px; left:86px; width:185px; height:14px; padding-left:4px; padding-top:6px; font-size:12px; text-shadow:1px 1px 0px white; white-space:nowrap; } .ItemInfo .close { position:absolute; top:3px; right:3px; width:11px; height:11px; display:block; background-repeat:no-repeat; background-color:transparent; border:none; } .ItemInfo .description { position:absolute; top:35px; left:100px; line-height:18px; width:170px; height:75px; overflow-y:auto;} +.ItemInfo .description .description-inner { width: 150px } .ItemInfo .extend { position:absolute; right:4px; bottom:3px; width:13px; height:13px; border:none; background-repeat:no-repeat; background-color:transparent; } .ItemInfo .cardlist { border-radius:5px; background:white; padding:2px; margin-top:3px; } diff --git a/src/UI/Components/ItemInfo/ItemInfo.html b/src/UI/Components/ItemInfo/ItemInfo.html index bffd62d..c58c981 100644 --- a/src/UI/Components/ItemInfo/ItemInfo.html +++ b/src/UI/Components/ItemInfo/ItemInfo.html @@ -1,11 +1,15 @@ -
-
-
- -
- -
-
+
+
+
+ +
+ +
+
+
+
+ +
diff --git a/src/UI/Components/ItemInfo/ItemInfo.js b/src/UI/Components/ItemInfo/ItemInfo.js index cdac585..29ba0cc 100644 --- a/src/UI/Components/ItemInfo/ItemInfo.js +++ b/src/UI/Components/ItemInfo/ItemInfo.js @@ -21,6 +21,7 @@ define(function(require) var Client = require('Core/Client'); var KEYS = require('Controls/KeyEventHandler'); var CardIllustration = require('UI/Components/CardIllustration/CardIllustration'); + var Mouse = require('Controls/MouseEventHandler'); var UIManager = require('UI/UIManager'); var UIComponent = require('UI/UIComponent'); var htmlText = require('text!./ItemInfo.html'); @@ -62,6 +63,7 @@ define(function(require) // Seems like "EscapeWindow" is execute first, push it before. var events = jQuery._data( window, 'events').keydown; events.unshift( events.pop() ); + resize(ItemInfo.ui.find('.container').height()); }; @@ -80,7 +82,7 @@ define(function(require) ItemInfo.init = function init() { this.ui.css({ top: 200, left:200 }); - + this.ui.find('.extend').mousedown(onResize); this.ui.find('.close') .mousedown(function(event){ event.stopImmediatePropagation(); @@ -116,7 +118,7 @@ define(function(require) ui.find('.title').text( item.IsIdentified ? it.identifiedDisplayName : it.unidentifiedDisplayName ); - ui.find('.description').text( item.IsIdentified ? it.identifiedDescriptionName : it.unidentifiedDescriptionName ); + ui.find('.description-inner').text( item.IsIdentified ? it.identifiedDescriptionName : it.unidentifiedDescriptionName ); // Add view button (for cards) if (item.type === ItemType.CARD) { @@ -152,8 +154,14 @@ define(function(require) for (i = 0; i < 4; ++i) { addCard(cardList, (item.slot && item.slot['card' + (i+1)]) || 0, i, slotCount); } + + if (!item.IsIdentified) { + cardList.parent().hide(); + } break; } + + resize(ItemInfo.ui.find('.container').height()); }; @@ -205,7 +213,71 @@ define(function(require) }); } - + /** + * Extend ItemInfo window size + */ + function onResize() + { + var ui = ItemInfo.ui; + var top = ui.position().top; + var left = ui.position().left; + var lastHeight = 0; + var _Interval; + + function resizing() + { + var h = Math.floor((Mouse.screen.y - top)); + if (h === lastHeight) { + return; + } + resize( h ); + lastHeight = h; + } + + // Start resizing + _Interval = setInterval(resizing, 30); + + // Stop resizing on left click + jQuery(window).on('mouseup.resize', function(event){ + if (event.which === 1) { + clearInterval(_Interval); + jQuery(window).off('mouseup.resize'); + } + }); + } + + + /** + * Extend ItemInfo window size + * + * @param {number} height + */ + function resize( height ) + { + var container = ItemInfo.ui.find('.container'); + var description = ItemInfo.ui.find('.description'); + var descriptionInner = ItemInfo.ui.find('.description-inner'); + var containerHeight = height; + var minHeight = 120; + var maxHeight = (descriptionInner.height() + 45 > 120) ? descriptionInner.height() + 45 : 120; + + if (containerHeight <= minHeight) { + containerHeight = minHeight; + } + + if (containerHeight >= maxHeight) { + containerHeight = maxHeight; + } + + container.css({ + height: containerHeight + }); + description.css({ + height: containerHeight - 45 + }); + } + + /** * Create component and export it */