Skip to content

Commit

Permalink
Merge pull request ZaneDubya#451 from ZaneDubya/msx752-Party-System
Browse files Browse the repository at this point in the history
Based on @msx752's party system (PR ZaneDubya#400).
Adds party system to Ultima.Player.PlayerState instance.
New gumps: party gump, party status gump.
Addresses issues ZaneDubya#421, ZaneDubya#330, parts of ZaneDubya#313, possibly others?
  • Loading branch information
ZaneDubya authored Nov 6, 2016
2 parents ea2dd50 + 067983b commit 3266ffb
Show file tree
Hide file tree
Showing 55 changed files with 1,710 additions and 755 deletions.
17 changes: 12 additions & 5 deletions dev/Configuration/UserInterfaceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ public class UserInterfaceSettings : ASettingsSection
private bool m_AlwaysRun;
private bool m_MenuBarDisabled;

private int m_SpeechColor;
private int m_EmoteColor;
private int m_PartyMsgColor;
private int m_GuildMsgColor;
private int m_SpeechColor = 4 * Utility.RandomValue(0, 99) * 5;
private int m_EmoteColor = 646;
private int m_PartyMsgPrivateColor = 58;
private int m_PartyMsgColor = 68;
private int m_GuildMsgColor = 70;
private bool m_IgnoreGuildMsg;
private int m_AllianceMsgColor;
private int m_AllianceMsgColor = 487;
private bool m_IgnoreAllianceMsg;
private bool m_CrimeQuery;

Expand Down Expand Up @@ -122,6 +123,12 @@ public int EmoteColor
set { SetProperty(ref m_EmoteColor, Clamp(value, 0, HueData.HueCount - 1)); }
}

public int PartyPrivateMsgColor
{
get { return m_PartyMsgPrivateColor; }
set { SetProperty(ref m_PartyMsgPrivateColor, Clamp(value, 0, HueData.HueCount - 1)); }
}

public int PartyMsgColor
{
get { return m_PartyMsgColor; }
Expand Down
4 changes: 2 additions & 2 deletions dev/Core/UI/UserInterfaceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public void Update(double totalMS, double frameMS)
for (int i = 0; i < m_Controls.Count; i++)
{
AControl c = m_Controls[i];
if (!c.IsInitialized)
if (!c.IsInitialized && !c.IsDisposed)
c.Initialize();
c.Update(totalMS, frameMS);
}
Expand Down Expand Up @@ -640,7 +640,7 @@ private void ClipMouse(ref Point position)
position.X = -8;
if (position.Y < -8)
position.Y = -8;
if (position.Y >= Width + 8)
if (position.X >= Width + 8)
position.X = Width + 8;
if (position.Y >= Height + 8)
position.Y = Height + 8;
Expand Down
1 change: 1 addition & 0 deletions dev/Ultima/Data/ChatMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public enum ChatMode {
Whisper,
Emote,
Party,
PartyPrivate,
Guild,
Alliance
}
Expand Down
11 changes: 8 additions & 3 deletions dev/Ultima/Data/MessageTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
*
***************************************************************************/

using System;

namespace UltimaXNA.Ultima.Data
{
[Flags]
public enum MessageTypes
{
Normal = 0x00,
Expand All @@ -23,11 +26,13 @@ public enum MessageTypes
Whisper = 0x08,
Yell = 0x09,
Spell = 0x0A,

Guild = 0x0D,
Alliance = 0x0E,
Command = 0x0F,

EncodedTriggers = 0xC0
/// <summary>
/// This is used for display only. This is not in the UO protocol. Do not send msgs of this type to the server.
/// </summary>
PartyDisplayOnly = 0x10,
EncodedTriggers = 0xC0 // 0x40 + 0x80
}
}
2 changes: 1 addition & 1 deletion dev/Ultima/Network/Client/AsciiSpeechPacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public AsciiSpeechPacket(MessageTypes type, int font, int hue, string lang, stri
int triggerCount; int[] triggers;
SpeechData.GetSpeechTriggers(text, lang, out triggerCount, out triggers);
if (triggerCount > 0)
type = (MessageTypes)(type | MessageTypes.EncodedTriggers);
type = type | MessageTypes.EncodedTriggers;

Stream.Write((byte)type);
Stream.Write((short)hue);
Expand Down
22 changes: 22 additions & 0 deletions dev/Ultima/Network/Client/Extensions/GuildLocationQueryPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/***************************************************************************
* GuildLocationQueryPacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;

namespace UltimaXNA.Ultima.Network.Client.Extensions {
/// <summary>
/// MapUO Protocol: Requests the position of all guild members.
/// </summary>
public class GuildLocationQueryPacket : SendPacket {
public GuildLocationQueryPacket()
: base(0xF0, "Query Guild Member Locations") {
Stream.Write((byte)0);
}
}
}
22 changes: 22 additions & 0 deletions dev/Ultima/Network/Client/Extensions/PartyLocationQueryPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/***************************************************************************
* PartyLocationQueryPacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;

namespace UltimaXNA.Ultima.Network.Client.Extensions {
/// <summary>
/// MapUO Protocol: Requests the position of all party members.
/// </summary>
public class PartyLocationQueryPacket : SendPacket {
public PartyLocationQueryPacket()
: base(0xF0, "Query Party Member Locations") {
Stream.Write((byte)0);
}
}
}
21 changes: 21 additions & 0 deletions dev/Ultima/Network/Client/Partying/PartyAcceptPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***************************************************************************
* PartyAcceptPacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;

namespace UltimaXNA.Ultima.Network.Client.Partying {
public class PartyAcceptPacket : SendPacket {
public PartyAcceptPacket(Serial invitingPartyLeader)
: base(0xbf, "Party Join Accept") {
Stream.Write((short)6);
Stream.Write((byte)8);
Stream.Write(invitingPartyLeader);
}
}
}
21 changes: 21 additions & 0 deletions dev/Ultima/Network/Client/Partying/PartyDeclinePacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***************************************************************************
* PartyDeclinePacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;

namespace UltimaXNA.Ultima.Network.Client.Partying {
public class PartyDeclinePacket : SendPacket {
public PartyDeclinePacket(Serial invitingPartyLeader)
: base(0xbf, "Party Join Decline") {
Stream.Write((short)6);
Stream.Write((byte)9);
Stream.Write(invitingPartyLeader);
}
}
}
22 changes: 22 additions & 0 deletions dev/Ultima/Network/Client/Partying/PartyLeavePacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/***************************************************************************
* PartyLeavePacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;
using UltimaXNA.Ultima.World;

namespace UltimaXNA.Ultima.Network.Client.Partying {
public class PartyLeavePacket : SendPacket {
public PartyLeavePacket()
: base(0xbf, "Leave Party") {
Stream.Write((short)6);
Stream.Write((byte)2);
Stream.Write(WorldModel.PlayerSerial);
}
}
}
21 changes: 21 additions & 0 deletions dev/Ultima/Network/Client/Partying/PartyLootEnablePacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***************************************************************************
* PartyCanLootPacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;

namespace UltimaXNA.Ultima.Network.Client.Partying {
class PartyCanLootPacket : SendPacket {
public PartyCanLootPacket(bool isLootable)
: base(0xbf, "Party Can Loot") {
Stream.Write((short)6);
Stream.Write((byte)6);
Stream.Write(isLootable);
}
}
}
22 changes: 22 additions & 0 deletions dev/Ultima/Network/Client/Partying/PartyPrivateMessagePacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/***************************************************************************
* PartyPrivateMessagePacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;

namespace UltimaXNA.Ultima.Network.Client.Partying {
public class PartyPrivateMessagePacket : SendPacket {
public PartyPrivateMessagePacket(Serial memberSerial, string msg)
: base(0xbf, "Private Party Message") {
Stream.Write((short)6);
Stream.Write((byte)3);
Stream.Write(memberSerial);
Stream.WriteBigUniNull(msg);
}
}
}
21 changes: 21 additions & 0 deletions dev/Ultima/Network/Client/Partying/PartyPublicMessagePacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***************************************************************************
* PartyPublicMessagePacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;

namespace UltimaXNA.Ultima.Network.Client.Partying {
public class PartyPublicMessagePacket : SendPacket {
public PartyPublicMessagePacket(string msg)
: base(0xbf, "Public Party Message") {
Stream.Write((short)6);
Stream.Write((byte)4);
Stream.WriteBigUniNull(msg);
}
}
}
21 changes: 21 additions & 0 deletions dev/Ultima/Network/Client/Partying/PartyRemoveMemberPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***************************************************************************
* PartyRemoveMemberPacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;

namespace UltimaXNA.Ultima.Network.Client.Partying {
public class PartyRemoveMemberPacket : SendPacket {
public PartyRemoveMemberPacket(Serial serial)
: base(0xbf, "Remove Party Member") {
Stream.Write((short)6);
Stream.Write((byte)2);
Stream.Write(serial);
}
}
}
21 changes: 21 additions & 0 deletions dev/Ultima/Network/Client/Partying/PartyRequestAddTargetPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***************************************************************************
* PartyRequestAddTargetPacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;

namespace UltimaXNA.Ultima.Network.Client.Partying {
class PartyRequestAddTargetPacket : SendPacket {
public PartyRequestAddTargetPacket()
: base(0xbf, "Add Party Member") {
Stream.Write((short)6);
Stream.Write((byte)1);
Stream.Write(0);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***************************************************************************
* PartyRequestRemoveTargetPacket.cs
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using UltimaXNA.Core.Network.Packets;

namespace UltimaXNA.Ultima.Network.Client.Partying {
public class PartyRequestRemoveTargetPacket : SendPacket {
public PartyRequestRemoveTargetPacket()
: base(0xbf, "Remove Party Member") {
Stream.Write((short)6);
Stream.Write((byte)2);
Stream.Write(0);
}
}
}
Loading

0 comments on commit 3266ffb

Please sign in to comment.