New opcodes, new logic, WIP instagib

This commit is contained in:
Amazed 2019-03-13 01:37:49 +01:00
parent 892b7c8ad4
commit 9284d63322
7 changed files with 744 additions and 48 deletions

View File

@ -20,6 +20,7 @@ from giants import APPLICATION_GUID
import random import random
from .DN_MSG_INTERNAL_SEND_CONNECT_INFO import DN_MSG_INTERNAl_SEND_CONNECT_INFO from .DN_MSG_INTERNAL_SEND_CONNECT_INFO import DN_MSG_INTERNAl_SEND_CONNECT_INFO
import asyncio import asyncio
from dpnet.gamepackets import *
logger = setup_logger(__name__) logger = setup_logger(__name__)
@ -317,6 +318,10 @@ class Netserver(asyncio.DatagramProtocol):
#logger.debug("OPCODE: %s VALUES: %s", struct.pack("<B", payload[0]).hex(), payload[1:].hex()) #logger.debug("OPCODE: %s VALUES: %s", struct.pack("<B", payload[0]).hex(), payload[1:].hex())
#await self.server.broadcast_message("SENT OPCODE: %s VALUES: %s" % (struct.pack("<B", payload[0]).hex(), payload[1:].hex())) #await self.server.broadcast_message("SENT OPCODE: %s VALUES: %s" % (struct.pack("<B", payload[0]).hex(), payload[1:].hex()))
event_player = self.get_player(session)
if event_player:
await self.server.broadcast_event("on_player_gamedata", player, payload)
if payload[0] == 0xc1: if payload[0] == 0xc1:
if not player or not player.phase == PlayerPhases.CFRAME_CONNECTED: if not player or not player.phase == PlayerPhases.CFRAME_CONNECTED:
logger.error("Fuck you. Playerphase was %s", player.phase) logger.error("Fuck you. Playerphase was %s", player.phase)
@ -451,9 +456,13 @@ class Netserver(asyncio.DatagramProtocol):
return return
playerping = 1 playerping = 1
await player.session.send_gamedata(b"\x2f\x02\x00\x00" + struct.pack("<H", playerping) + b"\x00", acknow=False) # acknow=True await player.session.send_gamedata(b"\x2f\x02\x00\x00" + struct.pack("<H", playerping) + b"\x00", acknow=False) # acknow=True
for i in range(0x06):
ack = (i % 2 == 0) # TODO: Understand this vv SPAWN TREES vv
await player.session.send_gamedata(b"\x04" + struct.pack("<B", i) + b"\x00\x00\x00\x00" + struct.pack("<B", i+0x07) + b"\x00\x00\x00",acknow=ack) #for i in range(0x06):
# ack = (i % 2 == 0)
# await player.session.send_gamedata(b"\x04" + struct.pack("<B", i) + b"\x00\x00\x00\x00" + struct.pack("<B", i+0x07) + b"\x00\x00\x00",acknow=ack)
await player.session.send_gamedata(b"\x04" + struct.pack("<B", 0) + b"\x00\x00\x00\x00" + struct.pack("<B", 0 + 0x07) + b"\x00\x00\x00")
# needed to avoid crash after Loading textures # needed to avoid crash after Loading textures
await player.session.send_gamedata(b"\x1a\xee\x02\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x83\x5f\xa4\x44\x00\xf9\xa3\xc2\x00\x00\x00\x00\xff\xff\x33\x43\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x9e\xdc\x07\x00", acknow=True) await player.session.send_gamedata(b"\x1a\xee\x02\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x83\x5f\xa4\x44\x00\xf9\xa3\xc2\x00\x00\x00\x00\xff\xff\x33\x43\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x9e\xdc\x07\x00", acknow=True)
@ -500,9 +509,6 @@ class Netserver(asyncio.DatagramProtocol):
# TODO: spawn all players except himself # TODO: spawn all players except himself
await self.spawn_all_players_except(player) await self.spawn_all_players_except(player)
# TODO: spawn player in other sessions
#await self.spawn_player_except(player)
# spawn Bot 3 as <id> # spawn Bot 3 as <id>
objid = "75" objid = "75"
plix = "01" plix = "01"
@ -520,6 +526,8 @@ class Netserver(asyncio.DatagramProtocol):
await player.session.send_gamedata(bytes.fromhex("090f000000015500000a02000000ff090f000000015500000a0200000001090f000000015500000a020000000300"), acknow=False) await player.session.send_gamedata(bytes.fromhex("090f000000015500000a02000000ff090f000000015500000a0200000001090f000000015500000a020000000300"), acknow=False)
await player.session.send_gamedata(bytes.fromhex("2b0000000066fe954400"), acknow=False) await player.session.send_gamedata(bytes.fromhex("2b0000000066fe954400"), acknow=False)
await self.server.broadcast_event("on_player_spawn", player)
player.phase = PlayerPhases.INGAME player.phase = PlayerPhases.INGAME
elif payload[0] == 0x0a and payload[1] == 0x32: elif payload[0] == 0x0a and payload[1] == 0x32:
@ -553,10 +561,6 @@ class Netserver(asyncio.DatagramProtocol):
player.z = playerz player.z = playerz
player.oid = objid player.oid = objid
player.o = orientation player.o = orientation
#logger.info("%s is now at coords (%s,%s,%s)", player.name, player.x, player.y, player.z)
if player.opts["debug"]:
await player.send_message("%s is now at coords (%s,%s,%s, %s). Model: %s" % (player.name, player.x, player.y, player.z, player.o, model))
await self.server.broadcast_gamedata_except(player, payload) await self.server.broadcast_gamedata_except(player, payload)
elif payload[0] == 0x3a: elif payload[0] == 0x3a:
@ -638,29 +642,7 @@ class Netserver(asyncio.DatagramProtocol):
if not direction == 0: if not direction == 0:
if player.opts["debug"]: if player.opts["debug"]:
await player.send_message("ObjID %s went: %s, o: %s" % (objid, direction, orientation)) await player.send_message("ObjID %s went: %s, o: %s" % (objid, direction, orientation))
await self.server.broadcast_gamedata_except(player, payload) # TODO: Replace with MSG_MOVE_PLAYER
elif payload[0] == 0x0a and payload[1] == 0x12:
player = self.get_player(session)
if not player:
logger.debug("Fuck that no player wtf man")
return
p = Packet(payload)
opcode = p.getByte()
length = p.getByte() # length?
unknown1 = p.getByte()
unknown2 = p.getByte()
unknown3 = p.getByte()
playerindex = p.getByte()
objid = p.getShort()
unknown5 = p.getByte()
unknown6 = p.getByte()
model = p.getULong()
direction = p.getShort()
orientation = p.getShort()
if not direction == 0:
if player.opts["debug"]:
await player.send_message("ObjID %s went: %s, o: %s" % (objid, direction, orientation))
await self.server.broadcast_gamedata_except(player, payload) await self.server.broadcast_gamedata_except(player, payload)
elif payload[0] == 0x05: # SPAWN OBJECT elif payload[0] == 0x05: # SPAWN OBJECT
@ -678,6 +660,56 @@ class Netserver(asyncio.DatagramProtocol):
player.oid = oid player.oid = oid
await self.server.broadcast_gamedata_except(player, payload) await self.server.broadcast_gamedata_except(player, payload)
await player.send_message("SPAWN: %s" % payload.hex())
elif payload[0] == 0x09 and payload[1] == 0x23:
player = self.get_player(session)
if not player:
logger.debug("Fuck that no player wtf man")
return
await player.send_message("PROJECTILE SHOOT: %s" % payload.hex())
await self.server.broadcast_gamedata_except(player, payload)
await self.server.broadcast_event("on_player_shoot", player)
elif payload[0] == 0x09 and payload[1] == 0x1a:
player = self.get_player(session)
if not player:
logger.debug("Fuck that no player wtf man")
return
await player.send_message("PROJECTILE EXPLOSION: %s" % payload.hex())
#await self.server.broadcast_gamedata_except(player, payload)
x = struct.unpack("<f", payload[14:18])[0]
y = struct.unpack("<f", payload[18:22])[0]
z = struct.unpack("<f", payload[22:26])[0]
await self.server.broadcast_gamedata(MSG_BULLET_EXPLOSION(player, 10, x, y, z).to_packet())
elif payload[0] == 0x09 and payload[1] == 0x0f:
player = self.get_player(session)
if not player:
logger.debug("Fuck that no player wtf man")
return
p = Packet(payload)
opcode = p.getByte()
opcode2 = p.getByte()
unknown = p.getByte()
unknown = p.getShort()
player_index = p.getByte()
unknown = p.getShort()
unknown = p.getByte()
unknown = p.getByte()
unknown = p.getULong()
weapon = p.getByte()
await player.send_message("SWITCH WEAPON: %s" % payload.hex())
await self.server.broadcast_gamedata_except(player, MSG_SWITCH_WEAPON(player, weapon).to_packet())
elif payload[0] == 0x0b: # MESSAGE_HIT
# 0b380437000004070000d48325c32dea66c2c0a0cf429fea0442091a00000004370000034d000000d48325c32dea66c2c0a0cf4200
player = self.get_player(session)
if not player:
logger.debug("Fuck that no player wtf man")
return
await player.send_message("HIT: %s" % payload.hex())
for p in self.server.players:
if p.name == "[Server]":
continue
await self.server.broadcast_gamedata(MSG_PLAYER_DIE(p, 1).to_packet())
else: else:
player = self.get_player(session) player = self.get_player(session)
if not player: if not player:

View File

@ -1,3 +1,5 @@
from . import *
APPLICATION_GUID = b"\x10\x5e\x62\xa7\x96\x1a\xd2\x11\x9a\xfc\x00\x60\x08\x45\xe5\x71" APPLICATION_GUID = b"\x10\x5e\x62\xa7\x96\x1a\xd2\x11\x9a\xfc\x00\x60\x08\x45\xe5\x71"
class Teams: class Teams:
@ -77,3 +79,558 @@ class ChatType:
All = 0x00 All = 0x00
AllFromPlayer = 0xc0 AllFromPlayer = 0xc0
TeamFromPlayer = 0xf0 TeamFromPlayer = 0xf0
class Models:
Generi_object = 0
Bases_Mec_Base = 981
Bases_Reape_Base = 985
Bases_Kabut_base = 1334
Markers_Default = 679
Markers_Mec_tea_1 = 679
Markers_Mec_tea_2 = 679
Markers_Reape_tea_1 = 679
Markers_Reape_tea_2 = 679
Markers_Kabuto = 679
Markers_Smarti_tunnel = 522
Markers_Vim_tea__wa_point = 679
Markers_Marke_Spline = 1052
Markers_Buo_Spline = 1098
Markers_Arm_Spline = 1162
Towers_Tower = 1041
Characters_Mecc = 2
Characters_Reaper = 3
Characters_Kabuto = 1
Characters_Vimp_Vimp = 8
Characters_Vimp_Foo_Chun_1 = 117
Characters_Vimp_Foo_Chun_2 = 1118
Characters_Vimp_Foo_Chun_3 = 1119
Characters_Smartie_Smartie = 11
Characters_Smartie_Femal_Smartie = 216
Characters_Shiner = 128
Characters_Charger_Charger = 574
Characters_Charger_Hotspot = 1064
Characters_Reaperman = 215
Characters_Sonak_Sonak = 575
Characters_Sonak_Seat = 586
Characters_Sonak_Ring = 607
Characters_Sonak_Reaperma_Shell = 1116
Characters_Se_Monster_Se_monster = 75
Characters_Se_Monster_Reaperma_Grenade = 276
Characters_Se_Monster_Lav_Ball = 1242
Ambience_Nea_Beac_ = 1279
Ambience_Mn_Beac_ = 1280
Ambience_Cliffs_San_ = 1281
Ambience_Beach_dar_ = 1282
Ambience_Beac_Wave_ = 1283
Ambience_Ligh_Rai_ = 1284
Ambience_Snow = 1285
Ambience_Race = 1286
Ambience_Darker = 1287
Ambience_Mountain = 1288
Ambience_Kabut_Stor_1 = 1289
Ambience_Kabut_Stor_5_Storm = 1290
Ambience_Crashe_Lander = 1291
Ambience_Floatin_Gate = 1293
Ambience_Cage = 1295
Ambience_Distan_Birds = 1296
Ambience_Win_Gusts = 1297
Ambience_Singl_Tree = 1298
Ambience_Trees = 1299
Ambience_Shoreline = 1300
Ambience_Pools = 1301
Ambience_Pier = 1302
Ambience_Bi_Lea_Tree = 1303
Ambience_Reape_Tower = 1304
Ambience_Interio_Volcano = 1305
Ambience_Smarti_Village = 1306
Ambience_Hig_Winds = 1308
Ambience_Prison = 1309
Ambience_Arm_Barracks = 1310
Ambience_Fores_Trees = 1312
Ambience_Distan_Animals = 1313
Ambience_Shoreline_Long = 1315
Ambience_Shoreline_Dark_Short = 1316
Ambience_Shoreline_Dark_Long = 1317
Ambience_River = 1318
Ambience_Hig_Wind_Light = 1319
Ambience_Col_Win_Gusts = 1320
Ambience_Kabut_Stro_2 = 1338
Ambience_Kabut_Stro_3 = 1339
Ambience_Kabut_Stor_4 = 1340
Ambience_Specia_Tree = 1342
Ambience_Pools_Large = 1343
Ambience_Boat = 1344
Ambience_Volcano = 1355
Bi_Walls_Archs_Arc_100 = 270
Bi_Walls_Archs_Arc_150 = 270
Bi_Walls_Archs_Arc_200 = 271
Bi_Walls_Corner = 273
Bi_Walls_Walls_Wal_100_Withou_Window = 274
Bi_Walls_Gate_portcullis = 555
Bi_Walls_Walls_Wal_150 = 556
Bi_Walls_Walls_Wal_200 = 557
Bi_Walls_Parapit = 558
Bi_Walls_Se_Reaper_Arc_100 = 559
Bi_Walls_Se_Reaper_Corner = 560
Bi_Walls_Columns_Colum_20 = 567
Bi_Walls_Columns_Colum_30 = 568
Bi_Walls_Columns_Colum_40 = 569
Bi_Walls_Columns_Colum_60 = 570
Bi_Walls_Bunker_Bunke_1 = 578
Bi_Walls_To_Platform = 579
Bi_Walls_To_Connec_1 = 580
Bi_Walls_Walls_Wal_100_Wit_Window = 587
Bi_Walls_Bunker_Bunker_Low = 588
Bi_Walls_Se_Reaper_Arc_150 = 601
Bi_Walls_Se_Reaper_Arc_200 = 602
Bi_Walls_Debri_Piec_1 = 611
Bi_Walls_Debri_Piec_2 = 612
Bi_Walls_Debri_Piec_3 = 613
Bi_Walls_Debri_Piec_4 = 614
Bi_Walls_Debri_Colum_1 = 615
Bi_Walls_Debri_Colum_2 = 616
Bi_Walls_Debri_Bunke_1 = 617
Bi_Walls_Damaged_Bunke_1_d1 = 652
Bi_Walls_Bunker_Bunke_Top = 653
Bi_Walls_Damaged_Bunker_Low_d1 = 654
Bi_Walls_Damaged_Colum_20_d1 = 655
Bi_Walls_Damaged_Columnc30_d1 = 656
Bi_Walls_Damaged_Colum_40_d1 = 657
Bi_Walls_Damaged_Colum_60_d1 = 658
Bi_Walls_Damaged_Parapit_d1 = 659
Bi_Walls_Columns_Colum_40_b = 706
Bi_Walls_Guar_Center = 1007
Bi_Walls_Gat_Swing = 1015
Bi_Walls_Fence = 1022
Birds_Standard = 210
Birds_Flak = 123
Birds_Lobird = 124
Birds_Feathe_1 = 223
Birds_Hitcher = 690
Birds_Marke_Spline = 1052
Bones_Femur = 977
Bones_Rib = 978
Bones_Spine = 979
Bridge_Bridge = 118
Bridge_Bridge_End = 247
Bridge_100ft = 256
Bridge_200ft = 257
Bridge_300ft = 258
Bridge_400ft = 528
Bridge_500ft = 532
Bridge_200ft_d = 705
Bridge_Wide = 1413
Effects_Dus_Ring = 620
Effects_Wate_Spray = 621
Effects_Dus_Blast = 622
Effects_Dus_Flash = 628
Effects_Shrap_Ground = 646
Effects_Dus_Ball = 671
Effects_Dus_Smoke = 672
Effects_Cas_Spell = 696
Effects_Rain = 697
Formations__Sonak_Guards = 1054
Formations___Sonak_Guards = 1058
Formations__m_Sonak__Guards = 1059
Formations_2x_Guards = 1067
Formations__Flyin_Guards = 1174
Formations__Ripper = 1176
Formations__Rippers = 1177
Formations__Kamikazi = 1180
Formations__Wid_Guards = 1314
Gian_Walls_Giantwal_1 = 1207
Gian_Walls_Giantwal_2 = 1208
Gian_Walls_Giantwal_3 = 1209
Gian_Walls_Giantwal_4 = 1277
Gian_Walls_Giantwal_5 = 1333
Gian_Walls_Giantwall3_Nick = 1359
Gian_Walls_efx_Reference_Giantwal_3 = 1394
Gian_Walls_efx_Giantwal_Debr_1 = 1395
Gian_Walls_efx_Giantwal_Debr_2 = 1396
Gian_Walls_efx_Giantwal_Debr_3 = 1397
Gian_Walls_efx_Giantwal_Debr_4 = 1398
Gian_Walls_efx_Giantwal_Debr_5 = 1399
Gian_Walls_efx_Giantwal_Debr_6 = 1400
Gian_Walls_efx_Giantwal_Debr_7 = 1401
Gian_Walls_efx_Giantwal_Debr_8 = 1402
Gian_Walls_efx_Giantwal_Debr_9 = 1403
Gian_Walls_efx_Giantwal_Debr_10 = 1404
Gian_Walls_efx_Giantwal_Debr_11 = 1405
Gian_Walls_efx_Giantwal_Debr_12 = 1406
Gian_Walls_efx_Giantwal_Debr_13 = 1407
Gian_Walls_efx_Giantwal_Debr_14 = 1408
Gian_Walls_efx_Reference_Giantwal_5 = 1409
Gian_Walls_efx_Giantwal_5_Debr_1 = 1410
Gian_Walls_efx_Giantwal_3_Debr_s = 1411
Guard_Arm_Barracks_Arm_Barracks = 1161
Guard_Arm_Barracks_Arm_Barrack_Husk = 1173
Guard_Barracks_Barracks = 686
Guard_Barracks_Min_Barracks = 1060
Guard_Barracks_Barrack_Husk = 1190
Guard_Barracks_Rippe_Barracks = 1226
Guard_Barracks_Barracks_Stor_2 = 1276
Guard_Barracks_efx_Reference_Min_Barracks = 1376
Guard_Barracks_efx_Min_Debri_Top = 1377
Guard_Barracks_efx_Min_Debr_1 = 1378
Guard_Barracks_efx_Min_Debr_2 = 1379
Guard_Barracks_efx_Min_Debr_3 = 1380
Guard_Barracks_efx_Rippe_Barrack_Debr_1 = 1391
Guard_Barracks_efx_Rippe_Barrack_Debr_2 = 1392
Guard_Barracks_efx_Rippe_Barrack_Debr_3 = 1393
Guard_Buildings_Muzzl_Flash = 662
Guard_Buildings_Muzzl_Flas_2 = 663
Guard_Buildings_Guar_Towe_1 = 1050
Guard_Buildings_Guar_Towe_2 = 1051
Guard_Buildings_Guar_Sam = 1061
Guard_Buildings_Guar_Turret = 1062
Guard_Buildings_Guar_Lift = 1065
Guard_Buildings_Guar_Lif_Strut = 1066
Guard_Buildings_Guar_Bunker = 1072
Guard_Buildings_Guar_Stable = 1074
Guard_Buildings_Guar_Shop = 1092
Guard_Buildings_Guar_Lif_Base = 1094
Guard_Buildings_Guar_Buoy = 1097
Guard_Buildings_Guar_Towe_1_d = 1127
Guard_Buildings_Guar_Bunker_d = 1128
Guard_Buildings_Guar_Towe_2_d = 1129
Guard_Buildings_Guar_Stable_d = 1138
Guard_Buildings_Guar_Portal = 1211
Guard_Buildings_Guar_Portal_m = 1213
Guard_Buildings_Guar_Buoy_coll = 1330
Guard_Buildings_efx_Reference_Guar_Towe_1 = 1381
Guard_Buildings_efx_Towe_Debr_1 = 1382
Guard_Buildings_efx_Towe_Debr_2 = 1383
Guard_Buildings_efx_Towe_Debr_3 = 1384
Guard_Buildings_efx_Towe_Debr_4 = 1385
Guard_Buildings_efx_Towe_Debr_5 = 1386
Guard_Buildings_efx_Reference_Guar_Towe_2 = 1387
Guard_Buildings_efx_Towe_2_Debr_1 = 1388
Guard_Buildings_efx_Towe_2_Debr_2 = 1389
Guard_Buildings_efx_Towe_2_Debr_3 = 1390
Guard_Drawbridge_Drawbridge = 1021
Guard_Drawbridge_Drawbridge_Open = 1056
Guard_Drawbridge_Drawbridge_coll = 1414
Guard_Drawbridge_Drawbridge_Open_coll = 1415
Guard_Lo_Launcher_Lo_Carrier = 683
Guard_Lo_Launcher_Lo_Launcher = 388
Guard_Lo_Launcher_Lo_Launche_Base = 389
Guard_Prison_Prison = 1023
Guard_Prison_Prinso_Crater = 1063
Guard_Reape_Tower = 1077
Guard_Turrets_Muzzl_Flash = 662
Guard_Turrets_Muzzl_Flas_2 = 663
Guard_Turrets_Guar_Sam = 1061
Guard_Turrets_Guar_Turret = 1062
Jetski_Reape_Jetski = 1076
Jetski_Homin_Pic_Up = 1099
Jetski_Missil_Pic_Up = 1100
Jetski_Turb_Pic_Up = 1101
Jetski_Jetski_coll = 1349
Jetski_Sign = 1374
Jetski_Reaperma_Jetski = 1159
Jetski_Reaperma_Jetski_coll = 1331
Kabuto_Stuff_Mu_Ball = 677
Kabuto_Stuff_Ho_Rock = 678
Kabuto_Stuff_Ho_Rock_d = 682
Kabuto_Stuff_Magi_Crystal = 1175
Kabuto_Stuff_Magi_Crysta_Shard = 1199
Kabuto_Stuff_Kabut_Stone = 1204
Kabuto_Stuff_Kabut_Ash = 1210
Kabuto_Stuff_Roc_Generator = 1215
Kabuto_Stuff_Lav_Ball = 1242
Kabuto_Stuff_Volcan_Debri = 1243
Kabuto_Stuff_Exhaust = 1244
Kabuto_Stuff_Roc_Generator_Top = 1246
Kabuto_Stuff_Kabut_Pad = 1334
Kabuto_Stuff_efx_Crysta_Debri = 1375
Kabuto_Stuff_Roc_Generator_coll = 1416
Kabuto_Leve_1_Ho_Spot = 749
Kabuto_Leve_1_Shield = 1018
Kabuto_Stor_5_Pocket = 1216
Kabuto_Stor_5_Spike = 1370
Kabuto_kstor_5_Kabut_Bridg_1 = 1371
Kabuto_kstor_5_Kabut_Bridg_2 = 1372
Kabuto_kstor_5_Kabut_Bridg_3 = 1373
Kabuto_Offspring_Reaperma_Grenade = 276
Kabuto_Offspring_Offspring = 745
Kabuto_Offspring_Offsprin_Egg = 746
Kabuto_Offspring_Offsprin_Egg_d1 = 747
Kabuto_Offspring_Offsprin_Eggshell1 = 748
Kabuto_Offspring_Offsprin_Hotspot = 945
Lander_Mec_Lander = 4
Lander_Mec_Cras_1 = 208
Lander_Mothe_Ship = 1198
Mecc_Base_Muzzl_Flash_Ob_623 = 623
Mecc_Base_Muzzl_Flas_2_Ob_627 = 627
Mecc_Base_Muzzl_Flash_Ob_662 = 662
Mecc_Base_Muzzl_Flas_2_Ob_663 = 663
Mecc_Base_Wood_Wall = 709
Mecc_Base_Wood_Gift = 710
Mecc_Base_Wood_Pub = 711
Mecc_Base_Wood_Shop = 712
Mecc_Base_Stone_Wall = 714
Mecc_Base_Stone_Gift = 716
Mecc_Base_Stone_Shop = 717
Mecc_Base_Wood_Gate = 744
Mecc_Base_Smarti_Fir_Pit = 750
Mecc_Base_Damaged_Wood_Shop = 763
Mecc_Base_Damaged_Stone_Gift = 764
Mecc_Base_Damaged_Stone_Shop = 765
Mecc_Base_Damaged_Wood_Gift = 768
Mecc_Base_Damaged_Wood_Wall = 769
Mecc_Base_Damaged_Stone_Wall = 771
Mecc_Base_Damaged_Wood_Gate = 772
Mecc_Base_Damaged_Stone_Gate = 773
Mecc_Base_Stone_Gate = 775
Mecc_Base_Damaged_Wood_Pub = 779
Mecc_Base_Smarti_Dropoff = 834
Mecc_Base_Fu_House = 918
Mecc_Base_Damaged_Fu_House = 936
Mecc_Base_Mec_Bas_Templat_1 = 981
Mecc_Base_P_Items_Teleport = 983
Mecc_Base_P_Items_Gyr_Pad = 984
Mecc_Base_P_Items_Min_Shop = 986
Mecc_Base_P_Items_Tower = 988
Mecc_Base_P_Items_Gyro = 991
Mecc_Base_Stone_Command = 1093
Mecc_Base_Wood_Command = 1095
Mecc_Base_P_Items_Sa_Turret = 1185
Mecc_Base_P_Items_Bul_Do_Turret = 1186
Mecc_Base_Damaged_Stone_Command = 1237
Mecc_Level1_Mecc = 2
Mecc_Level1_Useles_Effects_Bullet_Ob_14 = 14
Mecc_Level1_Weapons_Pistol_On_21 = 21
Mecc_Level1_Weapons_Shotgun_Ob_22 = 22
Mecc_Level1_Weapons_Syringe = 23
Mecc_Level1_Useles_Effects_Laser = 25
Mecc_Level1_Useles_Effects_Beamring = 28
Mecc_Level1_Weapons_Lasergun = 29
Mecc_Level1_Sho_Items_Bush = 36
Mecc_Level1_Useles_Effects_Zip = 38
Mecc_Level1_Weapons_Pistol_Ob_42 = 42
Mecc_Level1_Useles_Effects_Bullet_Ob_43 = 43
Mecc_Level1_Sho_Items_Turret = 60
Mecc_Level1_Useles_Effects_Thrust = 84
Mecc_Level1_Useles_Effects_Thrus_2 = 85
Mecc_Level1_Flag = 127
Mecc_Level1_Sho_Items_Jetpack = 254
Mecc_Level1_Weapons_Machinegun_Ob_300 = 300
Mecc_Level1_Weapons_Grenade = 301
Mecc_Level1_Weapons_Shotgun_Ob_302 = 302
Mecc_Level1_Weapons_Machinegun_Ob_303 = 303
Mecc_Level1_Pickups_Shells = 647
Mecc_Level1_Pickups_Clips = 648
Mecc_Level1_Pickups_Health = 649
Mecc_Level1_Pickups_Grenades = 650
Mecc_Level1_Bullets_Machinegu_Shell = 660
Mecc_Level1_Useles_Effects_Muzzl_Flash = 662
Mecc_Level1_Useles_Effects_Muzzl_Flas_2 = 663
Mecc_Level1_Useles_Effects_Blas_Ring = 667
Mecc_Level1_Useles_Effects_Shotgu_Blast = 668
Mecc_Level1_Useles_Effects_Nitr_Thrust = 781
Mecc_Level1_Weapons_Launcher = 785
Mecc_Level1_Weapons_Snipergun = 787
Mecc_Level1_Weapons_Mortar = 790
Mecc_Level1_Pickups_Snipe_Clip = 792
Mecc_Level1_Bullets_Sniper = 793
Mecc_Level1_Bullets_Rocket = 800
Mecc_Level1_Pickups_Rockets = 801
Mecc_Level1_Pickups_Morta_Bombs = 802
Mecc_Level1_Bullets_Proximity = 803
Mecc_Level1_Pickups_Proximity = 804
Mecc_Level1_Weapons_Mine = 805
Mecc_Level1_Bullets_Homing = 806
Mecc_Level1_Pickups_Homing = 807
Mecc_Level1_Bullets_Morta_Bomb = 808
Mecc_Level1_Sho_Items_Popupbomb = 822
Mecc_Level1_Sho_Items_Jetpac_2 = 892
Mecc_Level1_Sho_Items_Repairpack = 897
Mecc_Level1_Sho_Items_Repairgun = 898
Mecc_Level1_Sho_Items_Shield = 902
Mecc_Level1_Sho_Items_Bushpack = 920
Mecc_Level1_Bullets_Shotgu_Shell = 1114
Mecc_Level1_Pickups_Mines = 1123
Menus_mpselect = 1019
Menus_efx_Menu = 1020
Menus_idselect = 1025
Menus_wdselect = 1026
Menus_mu_gnselect = 1027
Musi_Temp_Kabuto = 1323
Musi_Temp_Mecc = 1324
Musi_Temp_Mec_Ambient = 1325
Musi_Temp_Mec_Battle = 1326
Musi_Temp_Mec_Sus = 1327
Permanen_Aliens_Explosion_Flash = 44
Permanen_Aliens_Explosion_Smok_Ring = 45
Permanen_Aliens_M_Invisible = 49
Permanen_Aliens_Cleaner = 685
Permanen_Aliens_Piranha = 1005
Pier_Straight = 533
Pier_Ben_90 = 534
Pier_Roun_Rings = 535
Pier_Pie_Roun_Tile = 536
Pier_Square = 537
Pier_Pos_20 = 538
Pier_Pos_30 = 539
Pier_Pos_40 = 540
Pier_Canop_1 = 563
Pier_Ben_Post = 564
Pier_Straigh_80 = 565
Pier_Straigh_160 = 566
Plants_b_Pod = 92
Plants_b_Bush = 93
Plants_s_Weeds = 129
Plants_b_Lilly = 130
Plants_s_Flowe_1 = 138
Plants_Mcbush = 245
Plants_Shrub_1 = 992
Plants_Shrub_2 = 993
Plants_Shrub_3 = 994
Plants_Shrub_5 = 996
Plants_Shrub_6 = 997
Plants_Shrub_7 = 998
Plants_Shrub_8 = 999
Plants_Shrub_9 = 1029
Plants_Shrub_10 = 1030
Plants_Shrub_11 = 1031
Plants_Shrub_5_coll = 1274
Plants_Ptree_Ptree = 101
Plants_Ptree_Ptre_Bob_Ptre_Bob = 102
Plants_Ptree__Lea_1 = 125
Plants_Ptree_Simple = 609
Plants_Ptree_Ptre_Bob_d1 = 664
Plants_Ptree_Ptre_Bob_Busted = 1006
Plants_Ptre_Canopy = 1045
Plants_Ptree_Ptre_Bob_coll = 1144
Raik_Reape_Bow = 30
Raik_Reape_Sword = 669
Raik_Rai_Hig_LoD = 1080
Raik_Rai_Lo_LoD = 1239
Raik_Reape_Queen_Hig_LoD = 666
Raik_Reape_Queen_Lo_LoD = 1240
Reaper_Base_Muzzl_Flas_1_Ob_623 = 623
Reaper_Base_Muzzl_Flas_1_Ob_662 = 662
Reaper_Base_Muzzl_Flas_2_Ob_627 = 627
Reaper_Base_Muzzl_Flas_2_Ob_663 = 663
Reaper_Base_1s_Leve_Buildings_Spellshop = 735
Reaper_Base_1s_Leve_Buildings_Magi_Wall = 1148
Reaper_Base_1s_Leve_Buildings_Magi_Gate = 1150
Reaper_Base_1s_Leve_Buildings_Magi_Wal_efx = 1255
Reaper_Base_1s_Leve_Buildings_Magi_Gat_efx = 1350
Reaper_Base_1s_Leve_Buildings_Extractor_Built = 729
Reaper_Base_1s_Leve_Buildings_Extractor_Destroyed = 730
Reaper_Base_2n_Leve_Buildings_Spellshop = 736
Reaper_Base_2n_Leve_Buildings_Magi_Wall = 1149
Reaper_Base_2n_Leve_Buildings_Magi_Gate = 1151
Reaper_Base_2n_Leve_Buildings_Magi_Wal_efx = 1332
Reaper_Base_2n_Leve_Buildings_Magi_Gat_efx = 1351
Reaper_Base_2n_Leve_Buildings_Workshop = 1152
Reaper_Base_2n_Leve_Buildings_Generator = 1154
Reaper_Base_2n_Leve_Buildings_Command = 1158
Reaper_Base_2n_Leve_Buildings_Fu_House = 1156
Reaper_Base_Smarti_Waitin_Pad = 851
Reaper_Base_Smarti_Buil_Pad = 857
Reaper_Base_Smarti_Dropoff = 858
Reaper_Base_Sou_Dropoff = 882
Reaper_Base_Damaged_1s_Leve_Buildings_Spellshop = 967
Reaper_Base_Damaged_1s_Leve_Buildings_Magi_Wall = 1228
Reaper_Base_Damaged_1s_Leve_Buildings_Magi_Gate = 1230
Reaper_Base_Damaged_1s_Leve_Buildings_Workshop = 1153
Reaper_Base_Damaged_1s_Leve_Buildings_Extractor = 970
Reaper_Base_Damaged_2n_Leve_Buildings_Spellshop = 968
Reaper_Base_Damaged_2n_Leve_Buildings_Magi_Wall = 1229
Reaper_Base_Damaged_2n_Leve_Buildings_Magi_Gate = 1231
Reaper_Base_Damaged_2n_Leve_Buildings_WorkShop = 1153
Reaper_Base_Damaged_2n_Leve_Buildings_Generator = 1155
Reaper_Base_Damaged_2n_Leve_Buildings_Command = 1238
Reaper_Base_Damaged_2n_Leve_Buildings_Fu_House = 1157
Reaper_Base_Reape_Bas_Templat_1 = 985
Reaper_Base_P_Items_Shop = 989
Reaper_Base_P_Items_Sk_Pier = 1181
Reaper_Base_P_Items_Turret = 1187
Reaper_Base_P_Items_Sa_Turret = 1188
Reaper_Base_P_Items_Tower = 1189
Reaper_Base_P_Items_Portal = 1192
Reaper_Flick_Reape_Character_1 = 3
Reaper_Flick_Reape_Character_2 = 311
Reaper_Flick_Bow = 30
Reaper_Flick_Sword = 669
Reaper_Ship_Ship = 1171
Reaper_Ship_Shi_Husk = 1172
Reaper_Ship_Galleon = 1214
Reaper_Spells_Tornado = 24
Reaper_Spells_M_Invisible = 40
Reaper_Leve_1_Tornad_Warning = 33
Reaper_Leve_1_Arrow = 34
Reaper_Leve_1_Reape_Head = 903
Reaper_Leve_1_Weapons_Fire = 35
Reaper_Leve_1_Weapons_Swor_Trail = 312
Reaper_Leve_1_Weapons_Bomb = 702
Reaper_Leve_1_Weapons_Homin_Bow = 928
Reaper_Leve_1_Weapons_Snipe_Bow = 929
Reaper_Leve_1_Weapons_Rp_Bow = 930
Reaper_Leve_1_Weapons_Power_u_Bow = 931
Reaper_Leve_1_Weapons_Mine = 1222
Reaper_Leve_1_Weapons_Health = 1224
Reaper_Leve_1_Pickups_Mine = 1223
Reaper_Leve_1_Pickups_Health = 1225
Reaper_Leve_1_Pickups_Repair = 1233
Reaper_Leve_1_Screamer = 934
Reaper_rstor_3_R_Star_Finish = 1147
Reaper_rstor_3_R_La_Marker = 1160
Reaper_rstor_3_Grid = 1164
Reaper_rstor_4_rstory4 = 1146
Reaper_rstor_5_Cave = 1166
Reaper_rstor_5_Volcan_Column = 1356
Reaper_rstor_5_Fake = 1357
Reaperman_Reaperman_Default = 215
Reaperman_Reaperman_Sniper = 215
Reaperman_Reaperman_Flyer = 215
Reaperman_Reaperman_Bomb = 215
Reaperman_Horn = 224
Reaperman_Spear = 240
Reaperman_Tracer = 275
Reaperman_Grenade = 276
Reaperman_Muzzl_Flash = 623
Reaperman_Gunseat = 625
Reaperman_Muzzl_Flas_2 = 627
Reaperman_Tuba = 693
Reaperman_Snipergun = 1047
Reaperman_Bazooka = 1048
Reaperman_Jetpack = 1049
Reaperman_Torch = 1055
Reaperman_Telescope = 1079
Reaperman_Bomb = 1203
Ripper_Ripper_Rippe_ri_1_6 = 73
Ripper_Rippe_Spit_Small = 90
Ripper_Rippe_Nest = 218
Ripper_Mound = 219
Ripper_Dir_1 = 220
Ripper_Rippe_Nes_x = 226
Ripper_Rippe_Spit_Big = 232
Ripper_Gore_Head = 1104
Ripper_Gore_Arm = 1105
Rocks_Rock_1 = 78
Rocks_Rock_2 = 79
Rocks_Rock_3 = 91
Rocks_Reaperma_Rock_1 = 680
Rocks_Reaperma_Rock_2 = 681
Rocks_Reaperma_Rock_3 = 687
Rocks_Deser_Rock_1 = 1042
Rocks_Deser_Rock_2 = 1043
Rocks_Deser_Rock_3 = 1044
Rocks_Stor_3_Ridge = 1096
Rocks_Pebble = 1163
Shadows_Round = 541
Shadows_Elipse = 542
Shadows_Elips_2 = 543
Shadows_Blastmar_1 = 618
Shadows_Blastmar_2 = 619
Sno_Stuff_Sno_Tree = 830
Sno_Stuff_Iceberg_1 = 1081
Sno_Stuff_Iceberg_2 = 1085
Sno_Stuff_Iceberg_3 = 1086
Sno_Stuff_Iceberg_4 = 1087
Sno_Stuff_Iceber_Ramp = 1088
Sno_Stuff_Ic_Wall = 1089

View File

@ -4,3 +4,8 @@ class Entity:
self.y = 0 self.y = 0
self.z = 0 self.z = 0
self.o = 0 self.o = 0
self.oid = 0
self._model = 0
def model(self):
return self._model

View File

@ -1,8 +1,9 @@
from .entity import Entity from .entity import Entity
import random import random
import struct import struct
from . import ChatColor, ChatType from . import ChatColor, ChatType, Models
from dpnet.DFrame import DFrame from dpnet.DFrame import DFrame
from dpnet.gamepackets import MSG_CHANGE_TEAM, MSG_PLAYER_PING
class PlayerPhases: class PlayerPhases:
@ -25,18 +26,18 @@ class Player(Entity):
self.id = random.getrandbits(16) self.id = random.getrandbits(16)
self.phase = PlayerPhases.NONE self.phase = PlayerPhases.NONE
self.ping = 1 self.ping = 1
self.oid = 0 self.opts = {"debug": True}
self.opts = {"debug": False}
async def change_team(self, newteam): def get_index(self):
return self.session.server.get_player_index(self)
async def change_team(self, newteam, respawn=True):
self.team = newteam self.team = newteam
await self.session.server.broadcast_event("on_player_change_team", self, self.team) await self.session.server.broadcast_event("on_player_change_team", self, self.team)
await self.session.server.broadcast_gamedata(MSG_CHANGE_TEAM(self, newteam, respawn).to_packet())
await self.session.server.broadcast_gamedata(b"\x10"+struct.pack("<B", self.team)+struct.pack("<L", self.id)+b"\x01\x00")
#await self.session.server.broadcast_gamedata(b"\x10"+struct.pack("<B", self.team)+struct.pack("<L", self.id)+b"\x01\x00")
async def send_ping(self, ping): async def send_ping(self, ping):
await self.session.server.broadcast_gamedata(b"\x2f\x02\x00\x00" + struct.pack("<H", ping) + b"\x00") await self.session.server.broadcast_gamedata(MSG_PLAYER_PING(self, ping).to_packet())
async def send_message(self, message, type=ChatType.All, playerindex=0, color=ChatColor.Orange): async def send_message(self, message, type=ChatType.All, playerindex=0, color=ChatColor.Orange):
options = type | color options = type | color
@ -51,3 +52,7 @@ class Player(Entity):
dframe.NRcv = self.session.next_expected_seq dframe.NRcv = self.session.next_expected_seq
dframe.SessID = self.session.SessID dframe.SessID = self.session.SessID
self.session.send(dframe) self.session.send(dframe)
def model(self):
# TODO: Fix
return Models.Characters_Mecc

View File

@ -1,11 +1,24 @@
from giants import ChatColor from giants import ChatColor
import asyncio import asyncio
import struct import struct
from dpnet.packet import Packet
from dpnet.gamepackets import *
from random import randint
class Commands: class Commands:
def __init__(self, server): def __init__(self, server):
self.server = server self.server = server
self.recorded = b''
self.recording = False
self.recordingplayer = None
self.nextweapon = 1
async def on_player_gamedata(self, player, gamedatabytes):
if self.recording:
self.recorded = gamedatabytes
self.recording = False
await self.recordingplayer.send_message("Packet recorded: %s" % (self.recorded.hex(),), color=ChatColor.Cyan)
async def on_player_chat(self, player, type, team, message): async def on_player_chat(self, player, type, team, message):
await self.server.broadcast_message_except(player, "%s: %s" % (player.name, message), color=ChatColor.Yellow) await self.server.broadcast_message_except(player, "%s: %s" % (player.name, message), color=ChatColor.Yellow)
@ -13,13 +26,16 @@ class Commands:
command = message.split(" ") command = message.split(" ")
if len(command) > 1 and command[0] == "team": if len(command) > 1 and command[0] == "team":
newteam = command[1].replace("\x00", "") newteam = command[1]
respawn = True
if len(command) > 2:
respawn = False if command[2] == "off" or command[2] == "no" or command[2] == "false" else True
print("Changing team of %s to %s" % (player.name, newteam)) print("Changing team of %s to %s" % (player.name, newteam))
await self.server.broadcast_message("%s switched to team %s using command" % (player.name, newteam)) await self.server.broadcast_message("%s switched to team %s using command" % (player.name, newteam))
await player.change_team(int(newteam)) await player.change_team(int(newteam), respawn=respawn)
if len(command) > 1 and command[0] == "ping": if len(command) > 1 and command[0] == "ping":
newping = command[1].replace("\x00", "") newping = command[1]
print("Changing ping of %s to %s" % (player.name, newping)) print("Changing ping of %s to %s" % (player.name, newping))
await self.server.broadcast_message("%s set his ping to %s" % (player.name, newping)) await self.server.broadcast_message("%s set his ping to %s" % (player.name, newping))
await player.send_ping(int(newping)) await player.send_ping(int(newping))
@ -56,7 +72,8 @@ class Commands:
if command[0] == "die" and len(command) > 1: if command[0] == "die" and len(command) > 1:
diemethod = int(command[1]) diemethod = int(command[1])
await player.send_message("Death by id: %s" % diemethod) await player.send_message("Death by id: %s" % diemethod)
await player.session.send_gamedata(bytes.fromhex("0b1a0000000002070000a5b0d4c35d9714c450abef354a68fb410914000000020700000402000000")+struct.pack("<L",diemethod)+bytes.fromhex("0000")) await self.server.broadcast_gamedata(MSG_PLAYER_DIE(player, diemethod).to_packet())
#await player.session.send_gamedata(bytes.fromhex("0b1a0000000002070000a5b0d4c35d9714c450abef354a68fb410914000000020700000402000000")+struct.pack("<L",diemethod)+bytes.fromhex("0000"))
if command[0] == "spawn" and len(command) > 1: if command[0] == "spawn" and len(command) > 1:
await self.server.broadcast_message("Spawning " + command[1] + "") await self.server.broadcast_message("Spawning " + command[1] + "")
@ -78,6 +95,72 @@ class Commands:
player.opts["debug"] = True player.opts["debug"] = True
await player.send_message("Debug enabled") await player.send_message("Debug enabled")
if command[0] == "record":
self.recording = True
self.recordingplayer = player
await player.send_message("Recording next packet...", color=ChatColor.Cyan)
if command[0] == "replayshow":
await player.send_message("Packet: %s" % (self.recorded.hex(),), color=ChatColor.Cyan)
if command[0] == "replay" or command[0] == "r" and len(command) == 1:
await player.session.send_gamedata(self.recorded)
await player.send_message("Sent packet %s to you" % (self.recorded.hex(),), color=ChatColor.Cyan)
if command[0] == "switch" and len(command) > 1:
newweap = int(command[1])
await player.send_message("Got you weapon %s" % newweap, color=ChatColor.Cyan)
await self.server.broadcast_gamedata(MSG_SWITCH_WEAPON(player, newweap).to_packet())
if command[0] == "s":
await player.send_message("Got you weapon %s" % (self.nextweapon,), color=ChatColor.Cyan)
await self.server.broadcast_gamedata(MSG_SWITCH_WEAPON(player, self.nextweapon).to_packet())
self.nextweapon += 1
if command[0] == "emptyweapons":
for _ in range(4):
await self.server.broadcast_gamedata(MSG_SWITCH_WEAPON(player, 0xff).to_packet())
await player.send_message("Emptied your weapons", color=ChatColor.Cyan)
if command[0] == "sniper":
p = Packet()
p.putByte(0x20)
p.putShort(self.server._nextid) # oid?
self.server._nextid += 1
p.putShort(0x0000)
p.putShort(0x0440)
p.putShort(0x0100)
p.putFloat(0) # x
p.putFloat(0) # y
p.putFloat(0) # z
p.putFloat(0) # o
p.putFloat(0x621c68c1) # wtf?
p.putShort(0x0000)
p.putShort(0x7041) # oid?
p.putShort(0x0000)
p.putShort(0x0300)
p.putLong(0x1e0000)
p.putLong(0x0)
p.putByte(0x00) # end
await self.server.broadcast_gamedata(p.getvalue())
if len(command) > 1 and command[0] == "drop":
weap = int(command[1])
await player.send_message("Dropped weapon %s" % weap, color=ChatColor.Cyan)
await self.server.broadcast_gamedata(MSG_DROP_WEAPON(player, self.server._nextid, weap, 255).to_packet())
self.server._nextid += 1
if command[0] == "coords":
await player.send_message("You are at (%s,%s,%s)" % (player.x, player.y, player.z), color=ChatColor.Cyan)
if command[0] == "tp":
x = randint(-200,200)
y = randint(-200,200)
z = randint(-200,200)
o = 0
await player.send_message("Teleporting you to (%s,%s,%s)" % (x, y, z), color=ChatColor.Cyan)
await self.server.broadcast_gamedata(MSG_PLAYER_TELEPORT(player, x, y, z, o).to_packet())
def setup(server): def setup(server):
plugin = Commands(server) plugin = Commands(server)

View File

@ -12,6 +12,7 @@ import traceback
import asyncio import asyncio
from aioconsole import ainput from aioconsole import ainput
import struct import struct
from curses import wrapper
logger = setup_logger(__name__) logger = setup_logger(__name__)
@ -152,6 +153,19 @@ class Server:
continue continue
await pplayer.send_message(text, color=color, type=type) await pplayer.send_message(text, color=color, type=type)
async def new_object(self, model):
oid = self._nextid
p = Packet()
p.putByte(0x05) # opcode
p.putByte(0)
p.putShort(self._nextid)
p.putByte(0x00)
p.putULong(model)
p.putByte(0x00)
self._nextid += 1
await self.broadcast_gamedata(p.getvalue())
return oid
async def spawn(self, player, model): async def spawn(self, player, model):
plix = self.get_player_index(player) plix = self.get_player_index(player)
p = Packet() p = Packet()
@ -264,13 +278,13 @@ class Server:
return self.players[playerindex] return self.players[playerindex]
if __name__ == '__main__': if __name__ == '__main__':
server = Server(name="giantsd", maxplayers=20, register=False, teams=Teams.MvM) #, map=Map("Three Way Island - Canyons.gck")) server = Server(name="giantsd", maxplayers=20, register=False, teams=Teams.MvM, map=Map("Three Way Island - Canyons.gck")) #, map=Map("Three Way Island - Canyons.gck"))
server.load_plugins() server.load_plugins()
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
listen = loop.create_datagram_endpoint(lambda: Netserver(server), local_addr=(server.listen_ip, server.listen_port)) listen = loop.create_datagram_endpoint(lambda: Netserver(server), local_addr=(server.listen_ip, server.listen_port))
transport, protocol = loop.run_until_complete(listen) transport, protocol = loop.run_until_complete(listen)
#loop.create_task(server.ask_command()) loop.create_task(server.ask_command())
try: try:
loop.run_forever() loop.run_forever()
except KeyboardInterrupt: except KeyboardInterrupt:

View File

@ -6,7 +6,7 @@ def setup_logger(name):
#_fh.setLevel("INFO") #_fh.setLevel("INFO")
_ch = logging.StreamHandler() _ch = logging.StreamHandler()
_ch.setLevel("DEBUG") _ch.setLevel("DEBUG")
_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') _formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
_ch.setFormatter(_formatter) _ch.setFormatter(_formatter)
#_fh.setFormatter(_formatter) #_fh.setFormatter(_formatter)
logger = logging.getLogger(name) logger = logging.getLogger(name)