Exemplo n.º 1
0
def Ressurect(Object, stream: ReadStream, address: Address,
              Server: GameServer):
    packet = WriteStream()
    Server.InitializeGameMessage(packet, Object.ObjectConfig["ObjectID"],
                                 0x00a0)
    Object.ObjectConfig["Health"] = Object.ObjectConfig["MaxHealth"]
    Object.ObjectConfig["Armor"] = Object.ObjectConfig["MaxArmor"]
    Server.brodcastPacket(packet, Object.Zone)
    Object.ObjectConfig["Alive"] = True
Exemplo n.º 2
0
def RunCommand(Object, stream: ReadStream, address: Address,
               Server: GameServer):
    if (Object.Parent.IsAdmin == True):
        clientState = stream.read(c_int)
        command = stream.read(str, length_type=c_ulong)
        args = command.split(" ")
        try:
            if (args[0] == "/loadWorld"):
                Server.LoadWorld(Object,
                                 int(args[1]),
                                 address,
                                 SpawnAtDefault=True)
            elif (args[0] == "/getJetpack"):
                packet = WriteStream()
                Server.InitializeGameMessage(packet,
                                             Object.ObjectConfig["ObjectID"],
                                             0x0231)
                packet.write(c_bit(True))
                packet.write(c_bit(False))
                packet.write(c_bit(True))
                packet.write(c_int(-1))  #EffectID
                packet.write(c_float(10))  #Air Speed
                packet.write(c_float(15))  #Max Air Speed
                packet.write(c_float(1.5))  #Vertical Velocity
                packet.write(c_int(0))
                Server.brodcastPacket(packet, Object.Zone)
            elif (args[0] == "/setConfig"):
                if (Object.ObjectConfig[args[1]] is not None):
                    configType = type(Object.ObjectConfig[str(args[1])])
                    if (configType == str):
                        Object.ObjectConfig[str(args[1])] = str(args[2])
                        print("Changed {} to {}".format(args[1], args[2]))
                    elif (configType == int):
                        Object.ObjectConfig[str(args[1])] = int(args[2])
                        print("Changed {} to {}".format(args[1], args[2]))
                    elif (configType == Vector3):
                        Object.ObjectConfig[str(args[1])] = Vector3(
                            float(args[2]), float(args[3]), float(args[4]))
                        print("Changed {} to ({}, {}, {})".format(
                            args[1], args[2], args[3], args[4]))
                    elif (configType == Vector4):
                        Object.ObjectConfig[str(args[1])] = Vector4(
                            float(args[2]), float(args[3]), float(args[4]),
                            float(args[5]))
                        print("Changed {} to ({}, {}, {}, {})".format(
                            args[1], args[2], args[3], args[4], args[5]))
        except Exception as e:
            print("Error While Executing Command : {}".format(e))

    else:
        print("{} Is Not An Admin!".format(Object.ObjectConfig("Name")))
Exemplo n.º 3
0
def HandleDetailedLoad(Server: GameServer, data: bytes, address: Address):
    session: Session = Server.Game.getSessionByAddress(address)
    player: Character = Server.Game.getCharacterByObjectID(session.ObjectID)

    zone: Zone = Server.Game.getZoneByID(player.Zone)
    zone.createObject(player)

    ldf = LDF()
    ldf.registerKey("levelid", player.Zone, 1)
    ldf.registerKey("objid", player.ObjectConfig["ObjectID"], 9)
    ldf.registerKey("template", player.ObjectConfig["LOT"], 1)
    ldf.registerKey("name", player.ObjectConfig["Name"], 0)

    root = ElementTree.Element("obj")
    root.set("v", "1")
    buff = ElementTree.SubElement(root, "buff")
    skill = ElementTree.SubElement(root, "skill")

    inv = ElementTree.SubElement(root, "inv")
    bag = ElementTree.SubElement(inv, "bag")
    bagInfo = ElementTree.SubElement(bag, "b")
    bagInfo.set("t", "0")
    bagInfo.set("m", str(player.ObjectConfig["Inventory"].Space))
    items = ElementTree.SubElement(inv, "items")
    itemIn = ElementTree.SubElement(items, "in")
    for item in player.ObjectConfig["Inventory"].InventoryList:
        i = ElementTree.SubElement(itemIn, "i")
        i.set("l", str(item["LOT"]))
        i.set("id", str(item["ObjectID"]))
        i.set("s", str(item["Slot"]))
        i.set("c", str(item["Quantity"]))
        i.set("b", str(int(item["Linked"])))
        i.set("eq", str(int(item["Equipped"])))

    mf = ElementTree.SubElement(root, "mf")
    char = ElementTree.SubElement(root, "char")
    char.set("cc", str(player.ObjectConfig["Currency"]))
    char.set("ls", str(player.ObjectConfig["UniverseScore"]))
    lvl = ElementTree.SubElement(root, "lvl")
    lvl.set("l", str(player.ObjectConfig["Level"]))

    pets = ElementTree.SubElement(root, "pet")

    mis = ElementTree.SubElement(root, "mis")
    done = ElementTree.SubElement(mis, "done")
    for mission in player.ObjectConfig["CompletedMissions"]:
        m = ElementTree.SubElement(done, "m")
        m.set("id", str(mission))
        m.set("cct", "1")
        m.set("cts", "0")
    cur = ElementTree.SubElement(mis, "cur")
    for mission in player.ObjectConfig["CurrentMissions"]:
        m = ElementTree.SubElement(cur, "m")
        m.set("id", str(mission.MissionID))
        sv = ElementTree.SubElement(m, "sv")
        sv.set("v", str(mission.Progress))

    ldf.registerKey("xmlData", root, 13)

    LegoData = WriteStream()
    ldf.writeLDF(LegoData)
    ldfBytes = bytes(LegoData)
    compressed = zlib.compress(ldfBytes)

    packet = WriteStream()
    writeHeader(packet, PacketHeader.DetailedUserInfo)
    packet.write(c_ulong(len(compressed) + 9))
    packet.write(c_bool(True))
    packet.write(c_ulong(len(ldfBytes)))
    packet.write(c_ulong(len(compressed)))
    packet.write(compressed)

    Server.send(packet, address)
    print("Sent Detailed User Info to Player {}".format(
        player.ObjectConfig["ObjectID"]))

    ConstructObjectsInZone(Server,
                           address,
                           zone.ZoneID,
                           ExcludeIDs=[player.ObjectConfig["ObjectID"]])

    if (player.Components == []):
        player.Components = player.findComponentsFromCDClient(Server.CDClient)

    Server.ReplicaManagers[zone.ZoneID].construct(player)

    doneLoadingObjects = WriteStream()
    Server.InitializeGameMessage(doneLoadingObjects,
                                 player.ObjectConfig["ObjectID"], 0x066a)
    Server.send(doneLoadingObjects, address)

    playerReady = WriteStream()
    Server.InitializeGameMessage(playerReady, player.ObjectConfig["ObjectID"],
                                 0x01fd)
    Server.send(playerReady, address)