Skip to content
This repository was archived by the owner on Feb 21, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions src/DB/Emotions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
55 changes: 54 additions & 1 deletion src/Engine/MapEngine/Entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');


/**
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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);
};
});
2 changes: 1 addition & 1 deletion src/Network/PacketStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion src/UI/Components/ItemInfo/ItemInfo.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions src/UI/Components/ItemInfo/ItemInfo.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<div class="ItemInfo" data-background="basic_interface/collection_bg.bmp">
<div class="container">
<div class="collection"></div>
<button class="view" data-background="basic_interface/btn_view.bmp" data-down="basic_interface/btn_view_a.bmp" data-hover="basic_interface/btn_view_b.bmp"></button>
<div class="title"></div>
<button class="close" data-background="basic_interface/sys_close_off.bmp" data-hover="basic_interface/sys_close_on.bmp"></button>
<div class="description"></div>
</div>
<div class="ItemInfo">
<div class="container" data-background="basic_interface/collection_bg.bmp">
<div class="collection"></div>
<button class="view" data-background="basic_interface/btn_view.bmp" data-down="basic_interface/btn_view_a.bmp" data-hover="basic_interface/btn_view_b.bmp"></button>
<div class="title"></div>
<button class="close" data-background="basic_interface/sys_close_off.bmp" data-hover="basic_interface/sys_close_on.bmp"></button>
<div class="description">
<div class="description-inner">
</div>
</div>
<button class="extend" data-background="btn_resize.bmp"></button>
</div>
<div class="cardlist">
<div class="border">
</div>
Expand Down
78 changes: 75 additions & 3 deletions src/UI/Components/ItemInfo/ItemInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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());
};


Expand All @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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());
};


Expand Down Expand Up @@ -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
*/
Expand Down