def guildShopBuy(request, response): """ 公会商店购买 """ player = request.player shopId = getattr(request.logic_request, "shopId", 0) info = u"公会商店购买" # 获取商店的信息。 guildShop = get_guildshop(shopId) if not player.guildshop.can_buy(shopId): return response if player.guild.gold < guildShop.cost: AlertHandler( player, response, AlertID.ALERT_GUILD_GOLD_NOT_ENOUGH, u"guildShopBuy need guild_gold %s now player has %s" % (guildShop.cost, player.guild.gold)) return response player.guildshop.buy(shopId) if guildShop.is_item: acquire_item(player, guildShop.itemId, number=guildShop.count, info=info) elif guildShop.is_equipfragment: acquire_equipfragment(player, guildShop.itemId, guildShop.count, info=info) elif guildShop.is_artifactfragment: acquire_artifactfragment(player, guildShop.itemId, number=guildShop.count, info=info) elif guildShop.is_soul: acquire_soul(player, guildShop.itemId, guildShop.count, info=info) else: raise ErrorException( player, u"mysteryShopBuy:arenashop(%s) is error" % (guildShop.itemId)) player.guild.sub_gold(guildShop.cost, info=info) rewards = [] rewards.append({"type": guildShop.itemId, "count": guildShop.count}) response.common_response.player.set("guild", player.guild.to_dict()) response.common_response.player.set("guildShop", player.guildshop.to_dict()) response.logic_response.set("rewards", rewards) return response
def debugGetAllHeroes(request, response): """ 英雄组队升级 """ player = request.player items = get_items() equips = get_equips() equipsfras = get_equipfragments() arts = get_artifacts() artfras = get_artifactfragments() souls = get_souls() for item in items: acquire_item(player, item, 10000) for equip in equips: acquire_equip(player, equip, 10000) for eqfa in equipsfras: acquire_equipfragment(player, eqfa, 10000) for art in arts: acquire_artifact(player, art, 10000) for artfa in artfras: acquire_artifactfragment(player, artfa, 10000) for soul in souls: acquire_soul(player, soul, 10000) playerheroes = player.heroes.all().keys() for hero in playerheroes: player.heroes.delete(hero) acquire_hero(player, 111000109, level=30, star=5, upgrade=9) acquire_hero(player, 111000209, level=30, star=5, upgrade=9) acquire_hero(player, 111000309, level=30, star=5, upgrade=9) acquire_hero(player, 111000509, level=30, star=5, upgrade=9) acquire_hero(player, 113000309, level=30, star=5, upgrade=9) acquire_hero(player, 112000209, level=30, star=5, upgrade=9) acquire_hero(player, 112000409, level=30, star=5, upgrade=9) acquire_hero(player, 112000509, level=30, star=5, upgrade=9) acquire_hero(player, 112000609, level=30, star=5, upgrade=9) acquire_hero(player, 112000709, level=30, star=5, upgrade=9) acquire_hero(player, 113000109, level=30, star=5, upgrade=9) acquire_hero(player, 114000209, level=30, star=5, upgrade=9) acquire_hero(player, 114000309, level=30, star=5, upgrade=9) acquire_hero(player, 114000409, level=30, star=5, upgrade=9) acquire_hero(player, 114000509, level=30, star=5, upgrade=9) acquire_hero(player, 114000609, level=30, star=5, upgrade=9) acquire_hero(player, 115000209, level=30, star=5, upgrade=9) acquire_hero(player, 115000309, level=30, star=5, upgrade=9) acquire_hero(player, 115000509, level=30, star=5, upgrade=9) acquire_hero(player, 116000109, level=30, star=5, upgrade=9) acquire_hero(player, 116000209, level=30, star=5, upgrade=9) acquire_hero(player, 116000309, level=30, star=5, upgrade=9) acquire_hero(player, 116000409, level=30, star=5, upgrade=9) acquire_hero(player, 116000509, level=30, star=5, upgrade=9) acquire_hero(player, 114000709, level=30, star=5, upgrade=9) acquire_hero(player, 116000709, level=30, star=5, upgrade=9) acquire_hero(player, 112000809, level=30, star=5, upgrade=9) return response
def add_equipfragment(request): player_code = request.REQUEST.get("player_code") player = get_player_by_id_or_str(player_code) equipfragment_id = request.REQUEST.get("equipfragment_id", 0) number = request.REQUEST.get("number", 0) equipfragment = get_equipfragment(equipfragment_id) if equipfragment: acquire_equipfragment(player, equipfragment.pk, int(number)) player.update() return HttpResponseRedirect(reverse("mobile_debug_index"))
def honorShopBuy(request, response): """ 荣誉商店兑换 """ arenashop_id = getattr(request.logic_request, "honorShopId", 0) player = request.player #检查竞技场开放状态 if not player.isOpenArena: return response arenashop = get_arenashop(arenashop_id) if not arenashop: raise ErrorException( player, u"honorShopBuy:arenashop(%s) no existed" % arenashop_id) info = u"荣誉商店兑换:%s" % arenashop_id if not player.arenashop.can_exchange(arenashop_id): response.common_response.player.set("honorShop", player.arenashop.to_dict()) AlertHandler( player, response, AlertID.ALERT_ARENASHOP_CAN_NO_EXCHANGE, u"honorShopBuy:arenashop(%s) can not buyed buyItem(%s) shopItem(%s)" % (arenashop_id, str( player.arenashop.buyItem), str(player.arenashop.shopItem))) return response if player.PVP.honor < arenashop.score: response.common_response.player.set("arena", player.PVP.to_dict()) AlertHandler( player, response, AlertID.ALERT_HONOR_NOT_ENOUGH, u"honorShopBuy:arenashop(%s) can not buyed honor(%s) playerhonor(%s)" % (arenashop_id, arenashop.score, player.PVP.honor)) return response player.PVP.sub_honor(arenashop.score, info=info) player.arenashop.exchange(arenashop.pk) if arenashop.is_item: acquire_item(player, arenashop.itemId, number=arenashop.count, info=info) elif arenashop.is_equipfragment: acquire_equipfragment(player, arenashop.itemId, arenashop.count, info=info) elif arenashop.is_artifactfragment: acquire_artifactfragment(player, arenashop.itemId, number=arenashop.count, info=info) elif arenashop.is_soul: acquire_soul(player, arenashop.itemId, number=arenashop.count, info=info) else: raise ErrorException( player, u"honorShopBuy:arenashop(%s) is error" % (arenashop_id)) response.common_response.player.set("honorShop", player.arenashop.to_dict()) # 这里只是为了更新荣誉点数,因为买东西消耗了这个 response.common_response.player.set("arena", player.PVP.to_dict()) return response
def niubility2(request): player_code = request.REQUEST.get("player_code") player = get_player_by_id_or_str(player_code) player.gold = 999999 player.yuanbo = 9999999 player.wood = 9999999 player.level = 50 player.firstIn = 0 player.end_tutorial() player.set("isOpenSiege", True) cur_player_buildings = player.buildings.all().keys() for bul in cur_player_buildings: player.buildings.delete(bul) position = [[1, 0], [8, 8], [17, 0], [17, 14], [17, 11], [15, 17], [12, 17], [13, 3], [17, 7], [5, 1], [0, 3], [0, 0], [0, 11], [9, 17], [13, 9], [17, 3]] i = 0 eliminate_building = [ 1002004, 1002001, 1003001, 1003002, 1003003, 1003004, 1003005, 1003006, 1003007, 1002002, 1002003, 1001016, 1004001, 1004002, 1004003, 1004004, 1004005, 1004006, 1004007, 1004008, 1004009 ] new_buildings = get_buildings() for building in new_buildings: if i < len(position): if building.pk in eliminate_building: continue acquire_building(player, building, centerX=position[i][0], centerY=position[i][1]) i = i + 1 else: break player.setArenaOpen() #添加神像碎片 buildingfragments = get_buildingfragments() for buildingfragment in buildingfragments: acquire_buildingfragment(player, buildingfragment, 1000) items = get_items() # arts = get_artifacts() equips = get_equips() souls = get_souls() equipsfras = get_equipfragments() artfras = get_artifactfragments() for item in items: acquire_item(player, item, 10000) for equip in equips: acquire_equip(player, equip, 10000) for eqfa in equipsfras: acquire_equipfragment(player, eqfa, 10000) for artfa in artfras: acquire_artifactfragment(player, artfa, 10000) for soul in souls: acquire_soul(player, soul, 10000) player.end_tutorial() player.update() return HttpResponseRedirect(reverse("mobile_debug_index"))