Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge pull request #70 from vthibault/party-and-friends

Party and friends UI
  • Loading branch information
vthibault committed Aug 12, 2014
2 parents b7dfa83 + bd51f40 commit 61857660ec9eaef42791dc283a52d1865e6fb66d
@@ -21,6 +21,7 @@ define(function( require )
var Preferences = require('Preferences/Controls');
var Camera = require('Renderer/Camera');
var Session = require('Engine/SessionStorage');
var Friends = require('Engine/MapEngine/Friends');
var PACKET = require('Network/PacketStructure');
var Network = require('Network/NetworkManager');
var Cursor = require('UI/CursorManager');
@@ -29,6 +30,7 @@ define(function( require )
var ContextMenu = require('UI/Components/ContextMenu/ContextMenu');
var Pet = require('UI/Components/PetInformations/PetInformations');
var Trade = require('UI/Components/Trade/Trade');
var getModule = require;


/**
@@ -210,6 +212,7 @@ define(function( require )
switch (this.objecttype) {
case Entity.TYPE_PET:
if (Session.petId === this.GID) {
ContextMenu.remove();
ContextMenu.append();
ContextMenu.addElement( DB.getMessage(596), Pet.ui.show.bind(Pet.ui)); // check pet status
ContextMenu.addElement( DB.getMessage(592), Pet.reqPetFeed); // Feed pet
@@ -221,20 +224,34 @@ define(function( require )

case Entity.TYPE_PC:
/// TODO: complete it :
/// - check for party leader action (invite)
/// - check for guild leader action (invite, ally, ...)
/// - check for admin action (kick, mute, ...)

ContextMenu.remove();
ContextMenu.append();
//ContextMenu.addElement( DB.getMessage(1362), checkPlayerEquipment);

// Trade option
ContextMenu.addElement( DB.getMessage(87).replace('%s', this.display.name), function(){
Trade.reqExchange(entity.GID, entity.display.name);
});
//ContextMenu.nextGroup();

//ContextMenu.addElement( DB.getMessage(360), openPrivateMessageWindow);
//ContextMenu.addElement( DB.getMessage(358), sendFriendInvitation);

if (!Friends.isFriend(this.display.name)) {
ContextMenu.nextGroup();
ContextMenu.addElement( DB.getMessage(358), function(){
Friends.addFriend(entity.display.name);
});
}

if (Session.hasParty && Session.isPartyLeader) {
ContextMenu.nextGroup();
ContextMenu.addElement( DB.getMessage(88).replace('%s', this.display.name), function(){
getModule('Engine/MapEngine/Group').onRequestInvitation(entity.GID, entity.display.name);
});
}

//ContextMenu.nextGroup();
//ContextMenu.addElement( DB.getMessage(315), blockUserPrivateMessage);
break;
@@ -31,7 +31,7 @@ define(function( require )
* Process command
*/
return function processCommand( text ){
var pkt;
var pkt, matches;
var cmd = text.split(' ')[0];

switch (cmd) {
@@ -170,6 +170,30 @@ define(function( require )
case 'q':
getModule('UI/Components/ChatRoom/ChatRoom').remove();
return;

case 'leave':
getModule('Engine/MapEngine/Group').onRequestLeave();
return;

case 'invite':
matches = text.match(/^invite\s+(")?([^"]+)(")?/);
if (matches && matches[2]) {
getModule('Engine/MapEngine/Group').onRequestInvitation(0, matches[2]);
return;
}
break;

case 'organize':
matches = text.match(/^organize\s+(")?([^"]+)(")?/);
if (matches && matches[2]) {
getModule('Engine/MapEngine/Group').onRequestCreationEasy(matches[2]);
return;
}
break;

case 'hi':
getModule('Engine/MapEngine/Friends').sayHi();
return;
}


@@ -47,6 +47,7 @@ define(function( require )
var ChatRoomCreate = require('UI/Components/ChatRoomCreate/ChatRoomCreate');
var Emoticons = require('UI/Components/Emoticons/Emoticons');
var SkillList = require('UI/Components/SkillList/SkillList');
var PartyFriends = require('UI/Components/PartyFriends/PartyFriends');


/**
@@ -135,13 +136,14 @@ define(function( require )
require('./MapEngine/Item').call();
require('./MapEngine/PrivateMessage').call();
require('./MapEngine/Storage').call();
require('./MapEngine/Group').call();
require('./MapEngine/Group').init();
require('./MapEngine/Guild').call();
require('./MapEngine/Skill').call();
require('./MapEngine/ChatRoom').call();
require('./MapEngine/Pet').call();
require('./MapEngine/Store').call();
require('./MapEngine/Trade').call();
require('./MapEngine/Friends').init();
}


@@ -176,6 +178,11 @@ define(function( require )
Session.Entity = new Entity( Session.Character );
Session.Entity.onWalkEnd = onWalkEnd;

// Reset
Session.petId = 0;
Session.hasParty = false;
Session.isPartyLeader = false;

BasicInfo.update('blvl', Session.Character.level );
BasicInfo.update('jlvl', Session.Character.joblevel );
BasicInfo.update('zeny', Session.Character.money );
@@ -250,13 +257,18 @@ define(function( require )
ChatRoomCreate.append();
Emoticons.append();
SkillList.append();
PartyFriends.append();

// Map loaded
Network.sendPacket(
new PACKET.CZ.NOTIFY_ACTORINIT()
);
};

if (!PartyFriends.__loaded) {
PartyFriends.prepare();
}

MapRenderer.setMap( pkt.mapName );
}

@@ -378,6 +390,7 @@ define(function( require )
StatusIcons.clean();
ChatBox.clean();
ShortCut.clean();
PartyFriends.clean()
MapRenderer.free();
Renderer.stop();
onRestart();
@@ -394,7 +407,10 @@ define(function( require )
switch (pkt.result) {
// Disconnect
case 0:
StatusIcons.clean();
ChatBox.clean();
ShortCut.clean();
PartyFriends.clean()
Renderer.stop();
onExitSuccess();
break;

0 comments on commit 6185766

Please sign in to comment.
You can’t perform that action at this time.