mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Added a work value change function for testing.
This commit is contained in:
parent
9372b4bc32
commit
ad88c0b28a
@ -16,31 +16,8 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
private static Dictionary<uint, Item> gamedataItems = Server.GetGamedataItems();
|
private static Dictionary<uint, Item> gamedataItems = Server.GetGamedataItems();
|
||||||
|
|
||||||
// For the moment, this is the only predefined item
|
|
||||||
// TODO: make a list/enum in the future so that items can be given by name, instead of by id
|
|
||||||
const UInt32 ITEM_GIL = 1000001;
|
const UInt32 ITEM_GIL = 1000001;
|
||||||
|
|
||||||
public void ChangeProperty(uint id, uint value, string target)
|
|
||||||
{
|
|
||||||
SetActorPropetyPacket ChangeProperty = new SetActorPropetyPacket(target);
|
|
||||||
|
|
||||||
ChangeProperty.SetTarget(target);
|
|
||||||
ChangeProperty.AddInt(id, value);
|
|
||||||
ChangeProperty.AddTarget();
|
|
||||||
|
|
||||||
Dictionary<uint, Session> sessionList = Server.GetServer().GetSessionList();
|
|
||||||
|
|
||||||
foreach (KeyValuePair<uint, Session> entry in sessionList)
|
|
||||||
{
|
|
||||||
SubPacket ChangePropertyPacket = ChangeProperty.BuildPacket((entry.Value.id), (entry.Value.id));
|
|
||||||
|
|
||||||
BasePacket packet = BasePacket.CreatePacket(ChangePropertyPacket, true, false);
|
|
||||||
packet.DebugPrintPacket();
|
|
||||||
|
|
||||||
entry.Value.QueuePacket(packet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// We only use the default options for SendMessagePacket.
|
/// We only use the default options for SendMessagePacket.
|
||||||
/// May as well make it less unwieldly to view
|
/// May as well make it less unwieldly to view
|
||||||
@ -68,7 +45,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
)
|
)
|
||||||
.SelectMany(str => str).ToArray();
|
.SelectMany(str => str).ToArray();
|
||||||
|
|
||||||
split = split.Select(temp => temp.ToLower()).ToArray(); // Ignore case on commands
|
split = split.ToArray(); // Ignore case on commands
|
||||||
|
|
||||||
var cmd = split[0];
|
var cmd = split[0];
|
||||||
|
|
||||||
@ -128,7 +105,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
if (split.Length == 4)
|
if (split.Length == 4)
|
||||||
{
|
{
|
||||||
ChangeProperty(Utils.MurmurHash2(split[1], 0), Convert.ToUInt32(split[2], 16), split[3]);
|
// ChangeProperty(Utils.MurmurHash2(split[1], 0), Convert.ToUInt32(split[2], 16), split[3]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -139,7 +116,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
if (split.Length == 4)
|
if (split.Length == 4)
|
||||||
{
|
{
|
||||||
ChangeProperty(Convert.ToUInt32(split[1], 16), Convert.ToUInt32(split[2], 16), split[3]);
|
//ChangeProperty(Convert.ToUInt32(split[1], 16), Convert.ToUInt32(split[2], 16), split[3]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -102,9 +102,8 @@ namespace FFXIVClassic_Map_Server
|
|||||||
//Chat Received
|
//Chat Received
|
||||||
case 0x0003:
|
case 0x0003:
|
||||||
ChatMessagePacket chatMessage = new ChatMessagePacket(subpacket.data);
|
ChatMessagePacket chatMessage = new ChatMessagePacket(subpacket.data);
|
||||||
Program.Log.Info("Got type-{5} message: {0} @ {1}, {2}, {3}, Rot: {4}", chatMessage.message, chatMessage.posX, chatMessage.posY, chatMessage.posZ, chatMessage.posRot, chatMessage.logType);
|
//Program.Log.Info("Got type-{5} message: {0} @ {1}, {2}, {3}, Rot: {4}", chatMessage.message, chatMessage.posX, chatMessage.posY, chatMessage.posZ, chatMessage.posRot, chatMessage.logType);
|
||||||
subpacket.DebugPrintSubPacket();
|
|
||||||
|
|
||||||
if (chatMessage.message.StartsWith("!"))
|
if (chatMessage.message.StartsWith("!"))
|
||||||
{
|
{
|
||||||
if (Server.GetCommandProcessor().DoCommand(chatMessage.message, session))
|
if (Server.GetCommandProcessor().DoCommand(chatMessage.message, session))
|
||||||
@ -227,7 +226,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x012F:
|
case 0x012F:
|
||||||
//subpacket.DebugPrintSubPacket();
|
subpacket.DebugPrintSubPacket();
|
||||||
ParameterDataRequestPacket paramRequest = new ParameterDataRequestPacket(subpacket.data);
|
ParameterDataRequestPacket paramRequest = new ParameterDataRequestPacket(subpacket.data);
|
||||||
if (paramRequest.paramName.Equals("charaWork/exp"))
|
if (paramRequest.paramName.Equals("charaWork/exp"))
|
||||||
session.GetActor().SendCharaExpInfo();
|
session.GetActor().SendCharaExpInfo();
|
||||||
|
@ -7,6 +7,8 @@ using FFXIVClassic.Common;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FFXIVClassic_Map_Server.actors.area;
|
using FFXIVClassic_Map_Server.actors.area;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
{
|
{
|
||||||
@ -354,6 +356,87 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
|
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SetWorkValue(Player player, string name, string uiFunc, object value)
|
||||||
|
{
|
||||||
|
string[] split = name.Split('.');
|
||||||
|
int arrayIndex = 0;
|
||||||
|
|
||||||
|
if (!(split[0].Equals("work") || split[0].Equals("charaWork") || split[0].Equals("playerWork") || split[0].Equals("npcWork")))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Object parentObj = null;
|
||||||
|
Object curObj = this;
|
||||||
|
for (int i = 0; i < split.Length; i++)
|
||||||
|
{
|
||||||
|
//For arrays
|
||||||
|
if (split[i].Contains("["))
|
||||||
|
{
|
||||||
|
if (split[i].LastIndexOf(']') - split[i].IndexOf('[') <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
arrayIndex = Convert.ToInt32(split[i].Substring(split[i].IndexOf('[') + 1, split[i].LastIndexOf(']') - split[i].LastIndexOf('[') - 1));
|
||||||
|
split[i] = split[i].Substring(0, split[i].IndexOf('['));
|
||||||
|
}
|
||||||
|
|
||||||
|
FieldInfo field = curObj.GetType().GetField(split[i]);
|
||||||
|
if (field == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (i == split.Length - 1)
|
||||||
|
parentObj = curObj;
|
||||||
|
curObj = field.GetValue(curObj);
|
||||||
|
if (curObj == null)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curObj == null)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Array, we actually care whats inside
|
||||||
|
if (curObj.GetType().IsArray)
|
||||||
|
{
|
||||||
|
if (((Array)curObj).Length <= arrayIndex)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (value.GetType() == ((Array)curObj).GetType().GetElementType() || TypeDescriptor.GetConverter(value.GetType()).CanConvertTo(((Array)curObj).GetType().GetElementType()))
|
||||||
|
{
|
||||||
|
if (value.GetType() == ((Array)curObj).GetType().GetElementType())
|
||||||
|
((Array)curObj).SetValue(value, arrayIndex);
|
||||||
|
else
|
||||||
|
((Array)curObj).SetValue(TypeDescriptor.GetConverter(value.GetType()).ConvertTo(value, curObj.GetType().GetElementType()), arrayIndex);
|
||||||
|
|
||||||
|
SetActorPropetyPacket changeProperty = new SetActorPropetyPacket(uiFunc);
|
||||||
|
changeProperty.AddProperty(this, name);
|
||||||
|
changeProperty.AddTarget();
|
||||||
|
SubPacket subpacket = changeProperty.BuildPacket(player.actorId, player.actorId);
|
||||||
|
player.playerSession.QueuePacket(subpacket, true, false);
|
||||||
|
subpacket.DebugPrintSubPacket();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (value.GetType() == curObj.GetType() || TypeDescriptor.GetConverter(value.GetType()).CanConvertTo(curObj.GetType()))
|
||||||
|
{
|
||||||
|
if (value.GetType() == curObj.GetType())
|
||||||
|
parentObj.GetType().GetField(split[split.Length - 1]).SetValue(parentObj, value);
|
||||||
|
else
|
||||||
|
parentObj.GetType().GetField(split[split.Length-1]).SetValue(parentObj, TypeDescriptor.GetConverter(value.GetType()).ConvertTo(value, curObj.GetType()));
|
||||||
|
|
||||||
|
SetActorPropetyPacket changeProperty = new SetActorPropetyPacket(uiFunc);
|
||||||
|
changeProperty.AddProperty(this, name);
|
||||||
|
changeProperty.AddTarget();
|
||||||
|
SubPacket subpacket = changeProperty.BuildPacket(player.actorId, player.actorId);
|
||||||
|
player.playerSession.QueuePacket(subpacket, true, false);
|
||||||
|
subpacket.DebugPrintSubPacket();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<float> GetPos()
|
public List<float> GetPos()
|
||||||
{
|
{
|
||||||
List<float> pos = new List<float>();
|
List<float> pos = new List<float>();
|
||||||
|
@ -8,6 +8,6 @@
|
|||||||
|
|
||||||
public bool betacheck = false;
|
public bool betacheck = false;
|
||||||
|
|
||||||
public bool[] event_achieve_aetheryte = new bool[512];
|
public bool[] event_achieve_aetheryte = new bool[128];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user