Added pistol to frog, more work on chat channels

This commit is contained in:
Waverunner
2014-03-30 15:09:48 -04:00
parent 235ee34056
commit 64bfdb2b8b
9 changed files with 229 additions and 11 deletions
+38
View File
@@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
import org.apache.mina.core.buffer.IoBuffer;
public class ChatCreateRoom extends SWGMessage {
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
return null;
}
}
+50
View File
@@ -0,0 +1,50 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
import org.apache.mina.core.buffer.IoBuffer;
public class ChatEnterRoomById extends SWGMessage {
private int roomId;
public ChatEnterRoomById() { }
@Override
public void deserialize(IoBuffer data) {
setRoomId(data.getInt());
}
@Override
public IoBuffer serialize() {
return null;
}
public int getRoomId() {
return roomId;
}
public void setRoomId(int roomId) {
this.roomId = roomId;
}
}
+4 -2
View File
@@ -28,9 +28,11 @@ import org.apache.mina.core.buffer.IoBuffer;
public class ChatOnSendRoomMessage extends SWGMessage {
private int errorCode;
private int msgId;
public ChatOnSendRoomMessage(int errorCode) {
public ChatOnSendRoomMessage(int errorCode, int msgId) {
this.errorCode = errorCode;
this.msgId = msgId;
}
@Override
@@ -43,7 +45,7 @@ public class ChatOnSendRoomMessage extends SWGMessage {
buffer.putShort((short) 3);
buffer.putInt(0xE7B61633);
buffer.putInt(errorCode);
buffer.putInt(1); // msg id
buffer.putInt(msgId); // msg id
return buffer.flip();
}
+71
View File
@@ -0,0 +1,71 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
import org.apache.mina.core.buffer.IoBuffer;
public class ChatSendToRoom extends SWGMessage {
private String message;
private int roomId;
private int msgId;
public ChatSendToRoom() { }
@Override
public void deserialize(IoBuffer data) {
setMessage(getUnicodeString(data));
data.getInt();
setRoomId(data.getInt());
setMsgId(data.getInt());
}
@Override
public IoBuffer serialize() {
return null;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getRoomId() {
return roomId;
}
public void setRoomId(int roomId) {
this.roomId = roomId;
}
public int getMsgId() {
return msgId;
}
public void setMsgId(int msgId) {
this.msgId = msgId;
}
}
+2
View File
@@ -25,6 +25,8 @@ import engine.resources.common.CRC;
public class Opcodes {
public static int ChatEnterRoomById = CRC.StringtoCRC("ChatEnterRoomById");
public static int ChatSendToRoom = CRC.StringtoCRC("ChatSendToRoom");
public static int ChatDeletePersistentMessage = 0x8F251641;
public static int ChatInstantMessageToCharacter = 0x84BB21F7;
public static int ChatPersistentMessageToServer = 0x25A29FA6;
+10
View File
@@ -93,6 +93,7 @@ public class DevService implements INetworkDispatch {
break;
case 4: // [Items] Misc Items
suiOptions.put((long) 40, "Unity Ring");
break;
}
final SUIWindow window = core.suiService.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, "Character Builder Terminal", "Select the desired option and click OK.", suiOptions, creature, null, 10);
@@ -275,6 +276,15 @@ public class DevService implements INetworkDispatch {
rifle1.setStringAttribute("cat_wpn_damage.damage", "800-1250");
inventory.add(rifle1);
SWGObject pistol = core.objectService.createObject("object/weapon/ranged/pistol/shared_pistol_cdef.iff", planet);
pistol.setIntAttribute("required_combat_level", 90);
pistol.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1);
pistol.setStringAttribute("class_required", "None");
pistol.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy");
pistol.setStringAttribute("cat_wpn_damage.damage", "400-559");
inventory.add(pistol);
return;
case 40:
TangibleObject ring = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet);
+1 -1
View File
@@ -67,7 +67,7 @@ public class EntertainmentService implements INetworkDispatch {
private ConcurrentHashMap<String, Short> designMap = new ConcurrentHashMap<String, Short>();
private Random ranWorkshop = new Random();
//private Random ranWorkshop = new Random();
private Map<String, PerformanceEffect> performanceEffects = new ConcurrentHashMap<String, PerformanceEffect>();
+1 -1
View File
@@ -153,7 +153,7 @@ public class GroupService implements INetworkDispatch {
addGroupBuffsToMember(group, leader);
addGroupBuffsToMember(group, invited);
//ChatRoom groupChat = core.chatService.createChatRoom(leader.getCustomName() + group.getObjectID(), "GroupChat", leader.getCustomName(), true);
//ChatRoom groupChat = core.chatService.createChatRoom("GroupChat", "group." + group.getObjectID(), leader.getCustomName(), true);
//group.setChatRoomId(groupChat.getRoomId());
//core.chatService.joinChatRoom(leader, groupChat.getRoomId());
+52 -7
View File
@@ -49,6 +49,7 @@ import resources.common.*;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
import protocol.swg.AddIgnoreMessage;
import protocol.swg.ChatEnterRoomById;
import protocol.swg.ChatOnChangeFriendStatus;
import protocol.swg.ChatDeletePersistentMessage;
import protocol.swg.ChatFriendsListUpdate;
@@ -64,6 +65,7 @@ import protocol.swg.ChatPersistentMessageToServer;
import protocol.swg.ChatRequestPersistentMessage;
import protocol.swg.ChatRoomList;
import protocol.swg.ChatRoomMessage;
import protocol.swg.ChatSendToRoom;
import protocol.swg.ChatSystemMessage;
import protocol.swg.ObjControllerMessage;
import protocol.swg.objectControllerObjects.PlayerEmote;
@@ -367,9 +369,53 @@ public class ChatService implements INetworkDispatch {
});
swgOpcodes.put(Opcodes.ChatCreateRoom, (session, data) -> {
//System.out.println("CREATE:");
//StringUtilities.printBytes(data.array());
});
swgOpcodes.put(Opcodes.ChatQueryRoom, (session, data) -> {
//System.out.println("QUERY: ");
//StringUtilities.printBytes(data.array());
});
swgOpcodes.put(Opcodes.ChatSendToRoom, (session, data) -> {
Client client = core.getClient(session);
if(client == null)
return;
SWGObject obj = client.getParent();
if (obj == null)
return;
ChatSendToRoom sentPacket = new ChatSendToRoom();
sentPacket.deserialize(data);
//ChatRoom room = getChatRoom(sentPacket.getRoomId());
sendChatRoomMessage((CreatureObject) obj, sentPacket.getRoomId(), sentPacket.getMsgId(), sentPacket.getMessage());
});
swgOpcodes.put(Opcodes.ChatEnterRoomById, (session, data) -> {
Client client = core.getClient(session);
if(client == null)
return;
SWGObject obj = client.getParent();
if (obj == null)
return;
ChatEnterRoomById sentPacket = new ChatEnterRoomById();
sentPacket.deserialize(data);
joinChatRoom((CreatureObject) obj, sentPacket.getRoomId());
//System.out.println("Entering room...");
});
}
@@ -687,10 +733,12 @@ public class ChatService implements INetworkDispatch {
return;
ChatOnEnteredRoom enterRoom = new ChatOnEnteredRoom(playerName, 0, roomId, true);
player.getClient().getSession().write(enterRoom.serialize());
if (!room.getUserList().contains(player))
room.getUserList().add(player);
room.getUserList().stream().forEach(user -> user.getClient().getSession().write(enterRoom.serialize()));
}
public void leaveChatRoom(CreatureObject player, int roomId) {
@@ -711,7 +759,7 @@ public class ChatService implements INetworkDispatch {
room.getUserList().remove(player);
}
public void sendChatRoomMessage(CreatureObject sender, int roomId, String message) {
public void sendChatRoomMessage(CreatureObject sender, int roomId, int msgId, String message) {
String senderName = sender.getCustomName().toLowerCase();
if (senderName.contains(" "))
@@ -720,17 +768,14 @@ public class ChatService implements INetworkDispatch {
ChatRoom room = getChatRoom(roomId);
if (room == null)
return;
ChatOnSendRoomMessage onSend = new ChatOnSendRoomMessage(ChatOnSendRoomMessage.SUCCESS);
ChatOnSendRoomMessage onSend = new ChatOnSendRoomMessage(0, msgId);
sender.getClient().getSession().write(onSend.serialize());
ChatRoomMessage roomMessage = new ChatRoomMessage(roomId, senderName, message);
Vector<CreatureObject> users = room.getUserList();
for (CreatureObject user : users) {
if (user == sender)
continue;
user.getClient().getSession().write(roomMessage.serialize());
}
}